Pause Notification Orchestrator
Component Detail
Description
Core service that coordinates the full notification flow when a peer mentor's pause status changes. Resolves the responsible coordinator via the org membership table, builds notification payloads for both parties, and dispatches to push and in-app channels. Handles both pause and resume transitions.
pause-notification-orchestrator
Summaries
The Pause Notification Orchestrator is the operational backbone that ensures coordinators and peer mentors are always kept in sync when availability status changes occur. By automatically identifying the responsible coordinator, constructing tailored notifications for both parties, and dispatching them across push and in-app channels, this component eliminates the operational blind spots that arise when status changes go unannounced. It directly reduces the risk of mentees being left without active support due to missed communications, protecting program quality and coordinator confidence in the platform as a reliable management tool.
This is a medium-complexity backend service with three direct dependencies — the notification builder, FCM dispatcher, and pause status repository — all of which must be delivered and integrated before this orchestrator can be fully tested end-to-end. The coordinator resolution logic (querying org membership to find the responsible coordinator) is a potential scheduling risk if org membership data is incomplete or the membership table schema is still being finalized. Comprehensive integration testing must cover pause activation, pause deactivation, missing coordinator edge cases, and partial delivery failures. Plan for at least one integration test sprint cycle after all dependencies stabilize.
Implemented as a backend service triggered by webhook events from the pause status workflow, this orchestrator follows a pipeline pattern: receive event → resolve coordinator → build payloads → dispatch to channels. The `resolveCoordinator` method queries the org membership table for a coordinator role record linked to the peer mentor's chapter or group — implement with a fallback for unassigned mentors (log warning, skip coordinator notification). `buildCoordinatorPayload` and `buildPeerMentorPayload` delegate to `pause-notification-builder` for message construction. Dispatch calls to `fcm-notification-dispatcher` should be fire-and-forget with async error logging, not blocking the webhook response.
Ensure idempotency by checking `pause_status_record` for duplicate event IDs before dispatching to prevent double notifications on webhook retries.
Responsibilities
- Receive pause status change events from the webhook handler
- Look up the coordinator responsible for the peer mentor via org membership
- Dispatch coordinator notification with peer mentor name, effective date, and optional reason
- Dispatch peer mentor confirmation notification for both state transitions
Interfaces
handlePauseActivated(peerMentorId: String, effectiveDate: DateTime, reason: String?)
handlePauseDeactivated(peerMentorId: String, effectiveDate: DateTime)
resolveCoordinator(peerMentorId: String): String
buildCoordinatorPayload(event: PauseEvent): NotificationPayload
buildPeerMentorPayload(event: PauseEvent): NotificationPayload
Relationships
Dependencies (3)
Components this component depends on
Related Data Entities (5)
Data entities managed by this component