notification.route.ts
Three faces of the same feature:
1. User routes (/api/v1/users/...)
Baby: “This is my phone’s FCM token and my notification preferences.”
- Register device token
- Update prefs (due reminders, streak warnings, …)
Models: device-token.model.ts, notification-preference.model.ts
2. Admin routes (/api/v1/admin/notifications/...)
Baby: “Staff debug dashboard for pushes.”
- Inspect logs, metrics, rollups
Models: notification-log.model.ts, notification-daily-rollup.model.ts
3. Internal routes (/internal/notifications/...)
Baby: “Hey server, it’s 8pm — send due reminders.”
- Protected by internal-key middleware
- Called from cloudflare-worker cron
Services in services/notifications/:
send-due-reminders.service.tssend-streak-warnings.service.tsfcm-sender.service.tsnotification-templates.ts
NOTIFICATION_DRY_RUN=true in dev prevents real pushes.
Last updated on