feat: notifications in the app and, optionally, by e-mail
Derived from events and kept per person: whoever a ticket is assigned to, whoever reports or works on it when it moves, fails QA or gets a comment, and whoever joins a project. Never about what you did yourself, once per event. They arrive live through a subscription to a bell in the header, and are copied by e-mail to whoever turns it on when SMTP_URL is set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,3 +6,4 @@ export * from './release.read-model';
|
||||
export * from './activity.read-model';
|
||||
export * from './project-stats.read-model';
|
||||
export * from './analytics.read-model';
|
||||
export * from './notification.read-model';
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
import { UserRefReadModel } from './user-ref.read-model';
|
||||
|
||||
/** Why someone is told. */
|
||||
export enum NotificationKind {
|
||||
/** A ticket was assigned to you. */
|
||||
ASSIGNED = 'ASSIGNED',
|
||||
/** A ticket you report or work on moved. */
|
||||
STATUS_CHANGED = 'STATUS_CHANGED',
|
||||
/** A ticket you work on went back from QA. */
|
||||
QA_FAILED = 'QA_FAILED',
|
||||
/** Someone commented on a ticket you report or work on. */
|
||||
COMMENTED = 'COMMENTED',
|
||||
/** Someone wrote @you. */
|
||||
MENTIONED = 'MENTIONED',
|
||||
/** A ticket you follow changed. */
|
||||
WATCHED = 'WATCHED',
|
||||
/** You were added to a project. */
|
||||
ADDED_TO_PROJECT = 'ADDED_TO_PROJECT',
|
||||
/** A ticket of yours is due soon or has been still for too long. */
|
||||
REMINDER = 'REMINDER',
|
||||
}
|
||||
|
||||
/**
|
||||
* One thing one person should know. Kept per recipient: it has its own read
|
||||
* state, and nobody reads anyone else's.
|
||||
*/
|
||||
export class NotificationReadModel {
|
||||
/** `<aggregateId>:<version>:<userId>`: the same event never notifies twice. */
|
||||
id!: string;
|
||||
userId!: string;
|
||||
kind!: NotificationKind;
|
||||
projectId!: string;
|
||||
projectKey!: string;
|
||||
issueId!: string | null;
|
||||
issueKey!: string | null;
|
||||
actor!: UserRefReadModel;
|
||||
summary!: string;
|
||||
readAt!: string | null;
|
||||
createdAt!: string;
|
||||
}
|
||||
|
||||
/** What a person wants to be told by e-mail as well. */
|
||||
export class NotificationSettingsReadModel {
|
||||
userId!: string;
|
||||
email!: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user