Skip to content

Implement the stubbed NotificationsService methods backing the live notifications API #1002

Description

@RUKAYAT-CODER

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.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions