mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add method to check if notification is scheduled
This commit is contained in:
@@ -42,6 +42,10 @@ export class InMemoryNotificationRepository implements NotificationRepository {
|
||||
return this.deviceIdsToDeliverTo[tuple.toString()][deviceId];
|
||||
}
|
||||
|
||||
async isNotificationScheduled(lookupArguments: NotificationLookupArguments): Promise<boolean> {
|
||||
return await this.getSecondsThresholdForNotificationIfExists(lookupArguments) !== null;
|
||||
}
|
||||
|
||||
async addOrUpdateNotification({
|
||||
shuttleId,
|
||||
stopId,
|
||||
@@ -71,4 +75,5 @@ export class InMemoryNotificationRepository implements NotificationRepository {
|
||||
|
||||
delete this.deviceIdsToDeliverTo[tupleKey.toString()][deviceId];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ export interface ScheduledNotification extends NotificationLookupArguments {
|
||||
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>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user