feat(doctor): add filtering logic for clinic doctor list with pagination and sorting
This commit is contained in:
+43
-9
@@ -246,22 +246,56 @@ Get doctors associated with a clinic.
|
||||
|-------|------|-------------|
|
||||
| `clinicUuid` | string (UUID) | Clinic UUID |
|
||||
|
||||
### Query Parameters
|
||||
| Param | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `page` | integer | ❌ | Default: 1 |
|
||||
| `limit` | integer | ❌ | Default: 10, max 50 |
|
||||
| `name` | string | ❌ | Filter by doctor name (`LIKE`) |
|
||||
| `specialty` | integer | ❌ | Specialty id |
|
||||
| `gender` | string | ❌ | `man` / `woman` |
|
||||
| `degree` | string | ❌ | `expert` / `general` / `specialist` / `subspecialistplus` |
|
||||
| `active` | 0\|1 | ❌ | Only doctors with appointments enabled |
|
||||
| `sort` | string | ❌ | `ASC` / `DESC` by rating (default `DESC`) |
|
||||
|
||||
> Filters apply **only within this clinic's** linked doctors.
|
||||
|
||||
> ⚠️ **Double-nested:** the doctors array is at `data.data` (extract with `data?.data?.data`); pagination is at `data.meta`.
|
||||
|
||||
### Response `200`
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": [
|
||||
{
|
||||
"uuid": "...",
|
||||
"title": "دکتر علی احمدی",
|
||||
"degree": "متخصص",
|
||||
"doctor_rate": 4.5,
|
||||
"image": "https://..."
|
||||
}
|
||||
]
|
||||
"data": {
|
||||
"data": [
|
||||
{
|
||||
"id": "1207",
|
||||
"uuid": "...",
|
||||
"name": "دکتر آرمان رضایی",
|
||||
"gender": "man",
|
||||
"degree": "specialist",
|
||||
"img": [],
|
||||
"specialties": [{ "uuid": "...", "id": "2", "name": "داخلی عمومی" }],
|
||||
"satisfaction": "96",
|
||||
"point": "4.8",
|
||||
"free_turn": "پنجشنبه 09:00–13:00",
|
||||
"hours_of_work": "شنبه تا چهارشنبه | پنجشنبه",
|
||||
"active": true
|
||||
}
|
||||
],
|
||||
"meta": { "totalRecords": 3, "totalPages": 1, "currentPage": 1 }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `free_turn` | string | Next available appointment (e.g. `پنجشنبه 09:00–13:00`), or `نوبت آزادی موجود نیست` if the doctor has no active weekly schedule |
|
||||
| `hours_of_work` | string | Working-days summary, or `برنامه کاری تنظیم نشده` when unscheduled |
|
||||
| `active` | boolean | `true` only when appointments are enabled **and** the doctor has an active schedule |
|
||||
|
||||
> `free_turn`/`hours_of_work`/`active` are computed from each doctor's `WeeklySchedule` (loaded in bulk by the endpoint). Without a schedule they fall back to the "not set" values.
|
||||
|
||||
### Errors
|
||||
| Code | HTTP | Description |
|
||||
|------|------|-------------|
|
||||
|
||||
Reference in New Issue
Block a user