Description
Implement the /api/v1/notifications route group and a shared notificationService that other modules (donations, KYC, distributions) can call to create notifications, matching the Notification model.
Acceptance Criteria
- notificationService.send(userId, type, title, message) creates a DB record and, if the user has email notifications enabled, sends an email via Nodemailer.
- GET /, GET /unread-count, PATCH /:id/read, PATCH /read-all, DELETE /:id all work and are scoped to the authenticated user only (can't read/mark another user's notifications).
- Email sending failure does not fail the underlying action that triggered it (e.g. a donation still confirms even if the email send fails) - log the error instead.
- Tests cover creation, read/unread state, and the "email failure doesn't block core action" behavior.
- Documented in openapi.yaml, including the specific POST /donation, POST /campaign-update, POST /distribution trigger endpoints.
Suggested reward: $25-$35
Description
Implement the /api/v1/notifications route group and a shared notificationService that other modules (donations, KYC, distributions) can call to create notifications, matching the Notification model.
Acceptance Criteria
Suggested reward: $25-$35