mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +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];
|
return this.deviceIdsToDeliverTo[tuple.toString()][deviceId];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async isNotificationScheduled(lookupArguments: NotificationLookupArguments): Promise<boolean> {
|
||||||
|
return await this.getSecondsThresholdForNotificationIfExists(lookupArguments) !== null;
|
||||||
|
}
|
||||||
|
|
||||||
async addOrUpdateNotification({
|
async addOrUpdateNotification({
|
||||||
shuttleId,
|
shuttleId,
|
||||||
stopId,
|
stopId,
|
||||||
@@ -71,4 +75,5 @@ export class InMemoryNotificationRepository implements NotificationRepository {
|
|||||||
|
|
||||||
delete this.deviceIdsToDeliverTo[tupleKey.toString()][deviceId];
|
delete this.deviceIdsToDeliverTo[tupleKey.toString()][deviceId];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export interface ScheduledNotification extends NotificationLookupArguments {
|
|||||||
export interface NotificationRepository {
|
export interface NotificationRepository {
|
||||||
getAllNotificationsForShuttleAndStopId(shuttleId: string, stopId: string): Promise<ScheduledNotification[]>;
|
getAllNotificationsForShuttleAndStopId(shuttleId: string, stopId: string): Promise<ScheduledNotification[]>;
|
||||||
getSecondsThresholdForNotificationIfExists(lookupArguments: NotificationLookupArguments): Promise<number | null>;
|
getSecondsThresholdForNotificationIfExists(lookupArguments: NotificationLookupArguments): Promise<number | null>;
|
||||||
|
isNotificationScheduled(lookupArguments: NotificationLookupArguments): Promise<boolean>;
|
||||||
addOrUpdateNotification(notification: ScheduledNotification): Promise<void>;
|
addOrUpdateNotification(notification: ScheduledNotification): Promise<void>;
|
||||||
deleteNotificationIfExists(lookupArguments: NotificationLookupArguments): Promise<void>;
|
deleteNotificationIfExists(lookupArguments: NotificationLookupArguments): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user