Service Layer low complexity backend
0
Dependencies
1
Dependents
1
Entities
0
Integrations

Description

Builds structured notification payloads for coordinator and peer mentor recipients based on the pause event type. Enforces the 200-character maximum on the optional reason field and localises message templates. Produces payloads compatible with the existing FCM dispatch function.

Feature: Pause Status Change Notifications

pause-notification-builder

Summaries

The Pause Notification Payload Builder ensures that every mentor pause and resume event triggers clear, consistent, and professionally formatted communications to both coordinators and peer mentors. By enforcing a 200-character cap on reason fields and applying locale-aware message templates, the system eliminates ambiguous or unprofessional notifications that could erode trust between program coordinators and mentors. This directly protects the relationship quality at the core of the mentorship program, reducing the risk of miscommunication-driven churn. Consistent, timely notifications also reduce the administrative burden on coordinators by removing the need to manually follow up on status changes, contributing to operational efficiency gains across the mentorship management workflow.

This component has low development complexity and a well-defined, narrow scope: four payload-building functions and one validation utility. It has zero dependencies on other components, which means it can be developed and tested in complete isolation, making it an ideal early-sprint deliverable with no scheduling risk from upstream blockers. The primary delivery consideration is aligning the message templates with the content team and ensuring locale configuration is settled before integration testing. Testing requirements are straightforward: unit tests covering all four payload types, the 200-character truncation boundary, and locale formatting.

No infrastructure provisioning is needed. Risk is minimal, but late changes to notification copy or locale requirements could require template rework.

This is a pure service-layer utility with no external dependencies, making it highly testable and easy to evolve. The four builder functions (`buildCoordinatorPausePayload`, `buildCoordinatorResumePayload`, `buildPeerMentorPauseConfirmation`, `buildPeerMentorResumeConfirmation`) each return a `NotificationPayload` struct compatible with the FCM dispatch function's input contract. The `validateReason` function applies the 200-character maximum constraint and should be called before payload assembly. Date formatting must integrate with the application-wide locale configuration — use the shared date formatting utility rather than inline formatting.

Since this component produces outputs consumed by the FCM dispatcher, ensure the `NotificationPayload` type definition is co-located or imported from a shared types module to prevent interface drift over time.

Responsibilities

  • Compose coordinator notification message with peer mentor name, effective date, and reason
  • Compose peer mentor confirmation message for pause and resume transitions
  • Enforce max 200-character constraint on reason field
  • Format date strings according to the app's locale settings

Interfaces

buildCoordinatorPausePayload(peerMentorName: String, date: DateTime, reason: String?): NotificationPayload
buildCoordinatorResumePayload(peerMentorName: String, date: DateTime): NotificationPayload
buildPeerMentorPauseConfirmation(date: DateTime): NotificationPayload
buildPeerMentorResumeConfirmation(date: DateTime): NotificationPayload
validateReason(reason: String): String

Relationships

Dependents (1)

Components that depend on this component

Related Data Entities (1)

Data entities managed by this component

API Contract

View full contract →
REST /api/v1/pause-notification-payloads 5 endpoints
GET /api/v1/pause-notification-payloads
GET /api/v1/pause-notification-payloads/:id
POST /api/v1/pause-notification-payloads
PUT /api/v1/pause-notification-payloads/:id
DELETE /api/v1/pause-notification-payloads/:id