feat(notifications): user notifications, recipients, audiences and the bell API (phase a) #9

Merged
KofTwentyTwo merged 2 commits from feature/notifications-a-tables into develop 2026-10-13 15:09:02 +00:00
KofTwentyTwo commented 2026-10-13 15:03:51 +00:00 (Migrated from github.com)

Phase (a) of docs/NOTIFICATIONS.md (#8).

Tables

  • alerts_notification (Notifications, a nav entry): title, markdown body, severity, category, source, link, audience, publish/expire, sticky, status, author, counts.
  • alerts_notification_recipient: one row per user (unique), delivered/read/dismissed/emailed. Locked to its user by a new alerts_recipient key (authors and alerts admins hold all-access). Users can change only read and dismissed; the qbit inserts and deletes.
  • alerts_notification_preference (My Notification Settings): per-category in-app mute and email mode; SECURITY can't be muted.
  • Pre-GA: the delivery log is renamed alerts_delivery and alerts_inbox_item is dropped (changesets 16-17, guarded by a precondition). In-app alert delivery now writes an ALERT notification and a recipient row, so alerts and notifications share one bell.

Admin: record actions Preview audience, Send now, Schedule and Retract (standard streamed-ETL review and result lines, alerts.notification.admin). Deleting a notification deletes its recipients. Scheduled sends and the retention purge run in the delivery job.

Audiences: ALL_USERS, ROLES, PERMISSION, USERS, resolved at send time through AlertsUserDirectoryInterface (default: everyone who has used Alerts), capped by maxAudienceSize.

Bell API (the Next UI contract, section 8.1): GET /inbox/summary (now with banners), GET /inbox (page and filters), POST /inbox/read|unread|dismiss. {alertId} still works.

SPI: NotificationSignal, NotificationAudience, NotificationSeverity, NotificationCategory in the stand-in package and AlertSinkInterface.notify (default no-op), mirroring the core PR.

Tests: NotificationsTest (authoring, preview, send, read, unread, dismiss, owner lock, edit after send, retract, page filters and paging, banners, producer dedup and links, audiences with a directory and permissions, validation, mutes, scheduling, expiry, purge, cascade delete), and the existing suites updated. ./mvnw verify: 61 tests, coverage gate met.

🤖 Generated with Claude Code

Phase (a) of [docs/NOTIFICATIONS.md](https://github.com/QRun-IO/qbit-alerts/blob/develop/docs/NOTIFICATIONS.md) (#8). **Tables** - `alerts_notification` (Notifications, a nav entry): title, markdown body, severity, category, source, link, audience, publish/expire, sticky, status, author, counts. - `alerts_notification_recipient`: one row per user (unique), delivered/read/dismissed/emailed. Locked to its user by a new `alerts_recipient` key (authors and alerts admins hold all-access). Users can change only read and dismissed; the qbit inserts and deletes. - `alerts_notification_preference` (My Notification Settings): per-category in-app mute and email mode; SECURITY can't be muted. - Pre-GA: the delivery log is renamed `alerts_delivery` and `alerts_inbox_item` is dropped (changesets 16-17, guarded by a precondition). In-app alert delivery now writes an ALERT notification and a recipient row, so alerts and notifications share one bell. **Admin**: record actions Preview audience, Send now, Schedule and Retract (standard streamed-ETL review and result lines, `alerts.notification.admin`). Deleting a notification deletes its recipients. Scheduled sends and the retention purge run in the delivery job. **Audiences**: ALL_USERS, ROLES, PERMISSION, USERS, resolved at send time through `AlertsUserDirectoryInterface` (default: everyone who has used Alerts), capped by `maxAudienceSize`. **Bell API** (the Next UI contract, section 8.1): `GET /inbox/summary` (now with banners), `GET /inbox` (page and filters), `POST /inbox/read|unread|dismiss`. `{alertId}` still works. **SPI**: `NotificationSignal`, `NotificationAudience`, `NotificationSeverity`, `NotificationCategory` in the stand-in package and `AlertSinkInterface.notify` (default no-op), mirroring the core PR. **Tests**: `NotificationsTest` (authoring, preview, send, read, unread, dismiss, owner lock, edit after send, retract, page filters and paging, banners, producer dedup and links, audiences with a directory and permissions, validation, mutes, scheduling, expiry, purge, cascade delete), and the existing suites updated. `./mvnw verify`: 61 tests, coverage gate met. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.