Skip to main content

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


3. Authentication Flow

Standard JWT validation.
  • Profile: Data is largely served from the JWT payload itself or by querying the parent_details table using the sub ID.
  • 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


7. Security Considerations

  • Isolation: Dashboard stats are strictly aggregated within the skole_id context.
  • 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 the fcm_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-verification flow.
  • 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.