From b2fb430a388a19d58ef9f64d051b6db8b926fb77 Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Thu, 27 Mar 2025 11:08:40 -0700 Subject: [PATCH] add notification event subscriber/unsubscriber --- src/repositories/NotificationRepository.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/repositories/NotificationRepository.ts b/src/repositories/NotificationRepository.ts index 6914bf8..8e6fdef 100644 --- a/src/repositories/NotificationRepository.ts +++ b/src/repositories/NotificationRepository.ts @@ -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; getSecondsThresholdForNotificationIfExists(lookupArguments: NotificationLookupArguments): Promise; isNotificationScheduled(lookupArguments: NotificationLookupArguments): Promise; addOrUpdateNotification(notification: ScheduledNotification): Promise; deleteNotificationIfExists(lookupArguments: NotificationLookupArguments): Promise; + + subscribeToNotificationChanges(listener: (event: NotificationEvent) => any): void; + unsubscribeFromNotificationChanges(listener: (event: NotificationEvent) => any): void; }