Overview
src/notifications/notifications.service.ts ends with a block commented // Stubs for other methods (to satisfy typecheck) containing send, sendTemplated, unsubscribe, findForUser, create, markRead, and markManyRead — returning null, [], undefined, or { data: [], total: 0 }. Every one of these is wired to a live route in NotificationsController: POST /notifications returns null, GET /notifications always reports an empty list, PATCH /notifications/:id/read marks nothing, and POST /notifications/unsubscribe/:userId unsubscribes no one. The notifications API is fully documented in Swagger and returns 200 for every call while doing nothing at all.
Specifications
Features:
- Every route exposed by
NotificationsController is backed by a real implementation.
- Unimplemented functionality fails loudly rather than returning a success-shaped empty response.
Tasks:
- Implement
create and send to persist a notification and dispatch it through the enabled channels using PreferencesService.
- Implement
findForUser with pagination and ordering, returning the standard paginated envelope.
- Implement
markRead and markManyRead with an ownership check on userId and a single bulk UPDATE.
- Implement
unsubscribe against the preferences entity, honouring the eventType argument.
- Until each is implemented, throw
NotImplementedException instead of returning an empty success value, so the gap is visible.
- Remove the
any parameter types in favour of the existing DTOs.
Impacted Files:
src/notifications/notifications.service.ts
src/notifications/notifications.controller.ts
src/notifications/preferences/preferences.service.ts
Acceptance Criteria
- Creating a notification then listing returns the created record.
- Marking a notification read persists and is reflected on the next read.
- Unsubscribing from an event type suppresses subsequent delivery for that type.
- No method in the service returns a hardcoded empty value.
- No
_dto: any signatures remain.
Overview
src/notifications/notifications.service.tsends with a block commented// Stubs for other methods (to satisfy typecheck)containingsend,sendTemplated,unsubscribe,findForUser,create,markRead, andmarkManyRead— returningnull,[],undefined, or{ data: [], total: 0 }. Every one of these is wired to a live route inNotificationsController:POST /notificationsreturnsnull,GET /notificationsalways reports an empty list,PATCH /notifications/:id/readmarks nothing, andPOST /notifications/unsubscribe/:userIdunsubscribes no one. The notifications API is fully documented in Swagger and returns 200 for every call while doing nothing at all.Specifications
Features:
NotificationsControlleris backed by a real implementation.Tasks:
createandsendto persist a notification and dispatch it through the enabled channels usingPreferencesService.findForUserwith pagination and ordering, returning the standard paginated envelope.markReadandmarkManyReadwith an ownership check onuserIdand a single bulkUPDATE.unsubscribeagainst the preferences entity, honouring theeventTypeargument.NotImplementedExceptioninstead of returning an empty success value, so the gap is visible.anyparameter types in favour of the existing DTOs.Impacted Files:
src/notifications/notifications.service.tssrc/notifications/notifications.controller.tssrc/notifications/preferences/preferences.service.tsAcceptance Criteria
_dto: anysignatures remain.