feat(representation): expose doctor representation details and add counts in admin views
This commit is contained in:
+45
-1
@@ -357,13 +357,18 @@ List all doctors with pagination.
|
||||
"degree": "متخصص",
|
||||
"gender": "male",
|
||||
"doctor_rate": 4.5,
|
||||
"active_doctor_appointment": true
|
||||
"active_doctor_appointment": true,
|
||||
"representation_id": 12,
|
||||
"representation_uuid": "9c1...",
|
||||
"representation_name": "علی محمدی"
|
||||
}
|
||||
],
|
||||
"meta": { "totalRecords": 92, "totalPages": 5, "currentPage": 1 }
|
||||
}
|
||||
```
|
||||
|
||||
> `representation_id`/`representation_uuid`/`representation_name` نمایندهی مالکِ پزشکاند؛ برای پزشکانِ بدون نماینده (مثل ایمپورتهای IRIMC) هر سه `null`.
|
||||
|
||||
---
|
||||
|
||||
### GET `/api/v1/admin/doctors/stats`
|
||||
@@ -761,18 +766,57 @@ Paginated representation list. Each item:
|
||||
"city": "یزد، تهران",
|
||||
"commission_percent": 10.0,
|
||||
"wallet_balance": 0,
|
||||
"doctor_count": 14,
|
||||
"appointment_count": 231,
|
||||
"is_active": true,
|
||||
"created_at": "2026-06-18T..."
|
||||
}
|
||||
```
|
||||
> `city_id` = اولین شهر (BC)؛ `city` = نام شهرها با «،». `is_global=true` یعنی نماینده سراسری (badge در پنل).
|
||||
|
||||
> `doctor_count` = تعداد پزشکانِ `representation_id = r.id`؛ `appointment_count` = تعداد نوبتهای آن پزشکان. هر دو با کوئری گروهی محاسبه میشوند (بدون N+1).
|
||||
|
||||
> `mobile_number` falls back to the linked user's mobile when the representation's own `mobile_number` column is empty.
|
||||
|
||||
> **Deactivation, not deletion:** the admin panel deactivates a representation via `PATCH /api/v1/representation/{uuid}` with `{ "active": false }` rather than calling `DELETE`.
|
||||
|
||||
---
|
||||
|
||||
### GET `/api/v1/admin/representations/{uuid}/doctors`
|
||||
|
||||
پزشکان زیرمجموعهی یک نماینده (paginated).
|
||||
|
||||
**Permission:** `ROLE_ADMIN`
|
||||
|
||||
### Query Parameters
|
||||
| Param | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `page` | integer | ❌ | Default: 1 |
|
||||
| `limit` | integer | ❌ | Default: 15 (max 100) |
|
||||
|
||||
### Response `200`
|
||||
Paginated. Each item:
|
||||
```json
|
||||
{
|
||||
"uuid": "...",
|
||||
"id": 45,
|
||||
"name": "دکتر علی احمدی",
|
||||
"gender": "man",
|
||||
"medical_code": "12345",
|
||||
"is_active": true,
|
||||
"owner_status": "claimed",
|
||||
"appointment_count": 17,
|
||||
"created_at": "2026-06-18T..."
|
||||
}
|
||||
```
|
||||
|
||||
### Errors
|
||||
| Code | HTTP | Description |
|
||||
|------|------|-------------|
|
||||
| `ERR_NOT_FOUND_001` | 404 | نماینده یافت نشد |
|
||||
|
||||
---
|
||||
|
||||
## Secretary Management
|
||||
|
||||
### GET `/api/v1/admin/secretaries`
|
||||
|
||||
Reference in New Issue
Block a user