Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

08 — Form Specifications (Notifications Module)

Notifications are system-generated — there is no user-facing creation form in v1. The only user inputs are implicit (taps/actions) and two query params. This file documents those plus the (planned) admin form, since a send endpoint is named in the blueprint.


1. Implicit Inputs (no form UI)

1.1 List query — GET /api/v1/notifications

ParamTypeConstraintsDefaultSource
pageint≥ 11list-notifications.dto.ts:6-11
limitint1..10020list-notifications.dto.ts:13-19
unreadOnlybooltrue/'true' coercedabsentlist-notifications.dto.ts:21-25

Invalid params → 400 via global validation pipe (main.ts). Client never sends unreadOnly=false (omit instead).

1.2 Read actions (no payload)

  • PATCH /api/v1/notifications/:id/read:id is a Mongo ObjectId.
  • PATCH /api/v1/notifications/read-all — empty body.
  • Ownership: cross-user :id200 null (notifications.service.ts:54-59), treated as no-op client-side.

2. Admin Manual-Send Form (planned)

Endpoint exists only in the blueprint — POST /api/v1/notifications/send (internal/service) (Notifications.md:24). Design when notification.send enters ALL_PERMISSIONS (currently absent — permissions.constants.ts).

FieldTypeRules (proposed, from blueprint semantics)
typeselectfrom server enum; unknown → 400
titletextrequired, ≤ 120 chars
bodytextarearequired, ≤ 500 chars
recipientIdsmulti-select≥ 1 user; tenant-scoped
dataJSONoptional, opaque (schema:28-29)
submitasync via BullMQ, never sync (Notifications.md:57)

3. Notification Preferences Form (planned)

GET/PATCH /api/v1/notifications/preferences (Notifications.md:27-28); the notification_preferences collection does not exist yet (Notifications.md:7).

FieldTypeRules (proposed)
channel toggles (email/push/in-app)switchesper-user, per-type optionality
SavePATCH with partial update; optimistic UI

4. Form Rules Summary

  • v1 shipped forms: none. All mutations are idempotent-ish actions; do not build form scaffolding for planned screens (01 §6, ponytail).
  • Validation mirrors server DTOs — client pre-validates only page/limit bounds to avoid 400 round-trips.