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; }