feat: add destination to the notification

This commit is contained in:
Nathnael
2026-07-06 08:08:07 +00:00
parent 8f5dfd83c5
commit 68c60f9e61
2 changed files with 53 additions and 6 deletions

View File

@@ -13,7 +13,11 @@ export enum NotificationAudience {
BACKOFFICE = "BACKOFFICE",
}
/** Drives channel fan-out: HIGH also pushes email/SMS, NORMAL is in-app only. */
/**
* Default channel fan-out when {@link NotifyInput.channels} is not given:
* HIGH also pushes email/SMS, NORMAL is in-app only. An explicit `channels`
* selection overrides this.
*/
export enum NotificationPriority {
NORMAL = "NORMAL",
HIGH = "HIGH",
@@ -36,6 +40,19 @@ export enum NotificationType {
CLEARANCE_REVIEW = "CLEARANCE_REVIEW",
}
/**
* Explicit fan-out channel selection for a single `notify(...)` call.
*
* In-app delivery is always performed (this module is an inbox) and is not
* listed here. These flags control the *extra* outbound channels. When omitted
* on {@link NotifyInput}, channels fall back to priority: HIGH ⇒ email + SMS,
* NORMAL ⇒ none.
*/
export interface NotificationChannels {
email?: boolean;
sms?: boolean;
}
/** Optional per-channel delivery outcome recorded on the notification row. */
export interface NotificationChannelsSent {
email?: boolean;
@@ -82,6 +99,12 @@ export interface NotifyInput {
link?: string | null;
data?: Record<string, unknown> | null;
priority?: NotificationPriority;
/**
* Explicit email/SMS fan-out. Overrides the priority-based default when set;
* omit to let `priority` decide (HIGH ⇒ email + SMS, NORMAL ⇒ in-app only).
* In-app is always delivered regardless.
*/
channels?: NotificationChannels;
}
/** Paginated list envelope for the notifications list endpoint. */