Infrastructure medium complexity backend
1
Dependencies
0
Dependents
0
Entities
0
Integrations

Description

Dispatches push notifications from admin-triggered actions such as certification reminder sends and bulk reminders to expiring mentors. Wraps the shared notification infrastructure with admin-specific templates and targeting logic based on org scope.

Feature: Organisation Admin Portal

admin-notification-dispatcher

Summaries

The Admin Notification Dispatcher enables organisation administrators to proactively reach out to mentors whose certifications are approaching expiry, directly from within the platform rather than relying on manual email campaigns or external tools. Timely reminders reduce the risk of mentors operating with lapsed credentials, which carries both regulatory and reputational consequences for the programme. By automating bulk reminders scoped to an administrator's own organisational hierarchy, the platform eliminates the administrative overhead of manually tracking expiry dates and composing outreach communications. A built-in dispatch log provides an auditable record of when reminders were sent, to whom, and by which admin, supporting accountability requirements and reducing disputes over notification delivery.

This capability directly improves compliance rates and frees administrators to focus on higher-value programme management activities.

This is a medium-complexity backend service component with a hard dependency on the admin-rls-guard, which must be complete and stable before notification dispatch can be wired up. Development involves integrating with the shared push-notification infrastructure, implementing org-scoped recipient queries, and building the dispatch log persistence layer. Testing requires both unit coverage of the targeting logic and integration tests that confirm org boundaries are respected — particularly that an admin cannot trigger notifications outside their hierarchy. End-to-end testing needs a staging notification environment to avoid sending test reminders to real users.

The dispatch log also implies a database schema addition that must be coordinated with the data team. Estimate one sprint for core implementation and a second sprint for audit-log UI and QA sign-off.

AdminNotificationDispatcher is a backend service component that wraps the shared notification infrastructure with admin-specific routing and templating. sendCertificationReminder(userId) resolves the target user's push token, selects the certification-reminder template, and enqueues a single dispatch event. sendBulkCertificationReminders(orgId, daysThreshold) queries the database for all mentors in the org subtree whose active certification expires within daysThreshold days, batches the resulting user IDs, and calls the shared notification queue for each batch, recording a DispatchEvent per recipient. The admin-rls-guard dependency ensures the invoking admin's JWT is validated and their org scope is extracted before any recipient query runs, preventing cross-org targeting at the service layer as a second line of defence after RLS.

getDispatchLog(orgId, from, to) performs a date-range query over the dispatch_events table filtered to the given org, returning structured log entries for audit display. All operations should be wrapped in try/catch with structured error logging for observability.

Responsibilities

  • Send certification expiry reminders to individual or bulk mentor recipients
  • Apply org-scoped targeting to ensure notifications stay within admin's hierarchy
  • Log notification dispatch events for audit trail

Interfaces

sendCertificationReminder(userId) -> void
sendBulkCertificationReminders(orgId, daysThreshold) -> DispatchResult
getDispatchLog(orgId, from, to) -> List<DispatchEvent>

Relationships

Dependencies (1)

Components this component depends on

API Contract

View full contract →
REST /api/v1/admin/notifications 6 endpoints
GET /api/v1/admin/notifications List notification dispatch log entries
GET /api/v1/admin/notifications/:id Get details of a single dispatch event
POST /api/v1/admin/notifications/certification-reminder Send a certification reminder to a single user
POST /api/v1/admin/notifications/bulk-certification-reminders Send bulk certification reminders to all users in org whose cert expires within N days
PUT /api/v1/admin/notifications/:id Retry or update a failed dispatch event
DELETE /api/v1/admin/notifications/:id Cancel a queued notification dispatch