Renewal Notification Service
Component Detail
Description
Scheduled backend job that queries the certifications table for records with expiry_date within configurable reminder windows (60, 30, and 7 days by default) and inserts notifications rows for matched users. Dispatch is idempotent: the job checks for an existing notification for the same user, certification, and reminder window before inserting. Reminder windows are read from organization_settings to support per-tenant renewal cycle configuration.
renewal-notification-service
Sources & reasoning
Core business logic for this feature. A scheduled backend job is the standard pattern for time-based reminder dispatch. Idempotency is required because the job runs repeatedly; without a duplicate check, users would receive multiple reminders per window. Per-org window configuration is needed because HLF has regulated renewal cycles that differ from other organizations.
No source references — this artifact was included based on reasoning alone (see above).
Responsibilities
- Query certifications for records within configured reminder windows
- Insert notification records idempotently, skipping duplicates for same user/certification/window
- Read per-organization reminder window configuration from organization_settings
- Trigger push dispatch via Push Notification Service for each new reminder
Interfaces
runRenewalCheck(): Promise<void>
getExpiringCertifications(windowDays: number): Promise<Certification[]>
hasReminderBeenSent(userId: string, certificationId: string, windowDays: number): Promise<boolean>
dispatchRenewalReminder(userId: string, certificationId: string, courseId: string): Promise<void>
Relationships
Related Data Entities (5)
Data entities managed by this component