1. API Purpose
This consolidated module handles the core “Home” experience. It manages personal profile data for parents and their children, tracks the history of push notifications sent to devices, and powers the summary dashboard that surfaces critical info at a glance.2. Endpoint Definition
| Method | Route | Auth | Description |
|---|---|---|---|
| GET | /parent-app/profile | 🔐 JWT | View parent/family profile |
| PUT | /parent-app/auth/device-info | 🔐 JWT | Update device info (FCM) |
| GET | /teachers-app/notifications | 🔐 JWT | View staff notification history |
| POST | /teachers-app/notifications/mark-read | 🔐 JWT | Mark push history as read |
| GET | /teachers-app/notifications/status | 🔐 JWT | Diagnostic: Notification subsystem status |
| POST | /teachers-app/notifications/test-parent | 🔐 JWT | Diagnostic: Trigger test notification |
| GET | /web-app/dashboard | 🔐 JWT | Admin: School overview stats |
| GET | /web-app/health | 🔓 Public | Diagnostic: Web App API health |
3. Authentication Flow
Standard JWT validation.- Profile: Data is largely served from the JWT payload itself or by querying the
parent_detailstable using thesubID. - Notifications: Access is limited to notifications specifically sent to the user’s ID/skole_id.
4. Request Structure
GET /parent-app/profile
Headers:PUT /parent-app/auth/device-info
Request Body:GET /teachers-app/notifications/status
Headers:POST /teachers-app/notifications/test-parent
Request Body:GET /web-app/health
Headers:5. Response Structure
Success: Profile View (200 OK)
Route:GET /parent-app/profile
Success: Device Info Updated (200 OK)
Route:PUT /parent-app/auth/device-info
Success: Notification History (200 OK)
Route:GET /teachers-app/notifications
Success: Notifications Marked Read (200 OK)
Route:POST /teachers-app/notifications/mark-read
Success: Diagnostic Status (200 OK)
Route:GET /teachers-app/notifications/status
Success: Test Push Triggered (200 OK)
Route:POST /teachers-app/notifications/test-parent
Success: Admin Dashboard Stats (200 OK)
Route:GET /web-app/dashboard
Success: Health Status (200 OK)
Route:GET /web-app/health
6. Error Responses
| HTTP Code | Description |
|---|---|
| 401 | Unauthorized: Token expired or invalid |
| 500 | Database connection error |
7. Security Considerations
- Isolation: Dashboard stats are strictly aggregated within the
skole_idcontext. - Privacy: Child profiles include medical ailments; these are only visible to the linked parent and assigned class teacher.
8. Token Usage
9. Token Refresh
N/A.10. Logout / Session Invalidation
Logout is handled here for the parent app, which clears thefcm_token from the parent_devices table to prevent ghost notifications.
11. Usage Example (cURL)
12. Notes / Special Behaviors
- FCM Registration: For parents, the push notification system relies on tokens registered during the
/auth-verificationflow. - Dashboard Aggregation: The dashboard API performs multiple internal counts (diary, attendance, write-to) to provide a single JSON response for the home screen.
- Fees Placeholder: The Fees UI exists as a planned feature; the current API serves a “Coming Soon” or empty state placeholder.