# Dashboard API Role-specific dashboard endpoints. Each endpoint requires the corresponding role JWT. --- ## GET /api/v1/dashboard/clinic Returns stats and today's schedule for the authenticated clinic owner. **Auth:** `ROLE_CLINIC` required ### Response `200` ```json { "success": true, "data": { "clinic": { "uuid": "string", "name": "string", "is_active": true, "logo": "string | null" }, "stats": { "total_doctors": 5, "today_appointments": 12, "this_month_appointments": 87, "pending_invitations": 2 }, "today_appointments": [ { "uuid": "string", "patient_name": "string | null", "doctor_name": "string", "slot_start": 1700000000, "status": "reserved" } ], "doctors": [ { "uuid": "string", "name": "string", "today_count": 3 } ] } } ``` `today_appointments` — up to 5 records, ordered by `slot_start ASC`. `doctors` — all doctors belonging to this clinic; each includes their appointment count for today. ### Errors | Code | HTTP | Description | |------|------|-------------| | `ERR_NOT_FOUND_001` | 404 | Clinic not found for this user | --- ## GET /api/v1/dashboard/doctor Returns stats and today's schedule for the authenticated doctor. **Auth:** `ROLE_DOCTOR` required ### Response `200` ```json { "success": true, "data": { "doctor": { "uuid": "string", "name": "string", "degree": "string | null" }, "stats": { "today_appointments": 8, "tomorrow_appointments": 5, "this_month_appointments": 62, "avg_rating": 4.6, "total_ratings": 34 }, "today_appointments": [ { "uuid": "string", "patient_name": "string | null", "patient_mobile": "string", "slot_start": 1700000000, "status": "reserved" } ], "clinics": [ { "uuid": "string", "name": "string", "logo": "string | null" } ] } } ``` `today_appointments` — up to 10 records, ordered by `slot_start ASC`. `avg_rating` — rounded to 1 decimal; `null` if no ratings yet. `clinics` — all clinics the doctor belongs to. ### Errors | Code | HTTP | Description | |------|------|-------------| | `ERR_NOT_FOUND_001` | 404 | Doctor profile not found for this user | --- ## GET /api/v1/dashboard/secretary Returns stats for the authenticated secretary and (conditionally) today's appointments. **Auth:** `ROLE_SECRETARY` required ### Response `200` ```json { "success": true, "data": { "doctor": { "uuid": "string", "name": "string", "degree": "string | null" }, "permissions": { "resources": { "appointments": { "view": true, "edit": false } } }, "stats": { "today_appointments": 8, "tomorrow_appointments": 5 }, "today_appointments": [ { "uuid": "string", "patient_name": "string | null", "patient_mobile": "string", "slot_start": 1700000000, "status": "reserved" } ] } } ``` `today_appointments` — only populated when `permissions.resources.appointments.view === true`; otherwise empty array. `today_appointments` — up to 10 records when visible. ### Errors | Code | HTTP | Description | |------|------|-------------| | `ERR_FORBIDDEN_001` | 403 | Secretary relation not configured or inactive |