add notification event subscriber/unsubscriber

This commit is contained in:
2025-03-27 11:08:40 -07:00
parent 2b28b94dbd
commit b2fb430a38

View File

@@ -14,10 +14,18 @@ export interface ScheduledNotification extends NotificationLookupArguments {
secondsThreshold: number;
}
export interface NotificationEvent {
notification: ScheduledNotification,
event: 'delete' | 'addOrUpdate'
}
export interface NotificationRepository {
getAllNotificationsForShuttleAndStopId(shuttleId: string, stopId: string): Promise<ScheduledNotification[]>;
getSecondsThresholdForNotificationIfExists(lookupArguments: NotificationLookupArguments): Promise<number | null>;
isNotificationScheduled(lookupArguments: NotificationLookupArguments): Promise<boolean>;
addOrUpdateNotification(notification: ScheduledNotification): Promise<void>;
deleteNotificationIfExists(lookupArguments: NotificationLookupArguments): Promise<void>;
subscribeToNotificationChanges(listener: (event: NotificationEvent) => any): void;
unsubscribeFromNotificationChanges(listener: (event: NotificationEvent) => any): void;
}