mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
add bindings for the notifications repository
This commit is contained in:
@@ -21,6 +21,16 @@ export class InMemoryNotificationRepository implements NotificationRepository {
|
||||
|
||||
private listeners: Listener[] = [];
|
||||
|
||||
constructor() {
|
||||
this.getAllNotificationsForShuttleAndStopId = this.getAllNotificationsForShuttleAndStopId.bind(this);
|
||||
this.getSecondsThresholdForNotificationIfExists = this.getSecondsThresholdForNotificationIfExists.bind(this);
|
||||
this.deleteNotificationIfExists = this.deleteNotificationIfExists.bind(this);
|
||||
this.addOrUpdateNotification = this.addOrUpdateNotification.bind(this);
|
||||
this.isNotificationScheduled = this.isNotificationScheduled.bind(this);
|
||||
this.subscribeToNotificationChanges = this.subscribeToNotificationChanges.bind(this);
|
||||
this.unsubscribeFromNotificationChanges = this.unsubscribeFromNotificationChanges.bind(this);
|
||||
}
|
||||
|
||||
async getAllNotificationsForShuttleAndStopId(shuttleId: string, stopId: string) {
|
||||
const tuple = new TupleKey(shuttleId, stopId);
|
||||
if (this.deviceIdsToDeliverTo[tuple.toString()] === undefined) {
|
||||
@@ -51,7 +61,8 @@ export class InMemoryNotificationRepository implements NotificationRepository {
|
||||
}
|
||||
|
||||
async isNotificationScheduled(lookupArguments: NotificationLookupArguments): Promise<boolean> {
|
||||
return await this.getSecondsThresholdForNotificationIfExists(lookupArguments) !== null;
|
||||
const threshold = await this.getSecondsThresholdForNotificationIfExists(lookupArguments);
|
||||
return threshold !== null;
|
||||
}
|
||||
|
||||
async addOrUpdateNotification({
|
||||
|
||||
Reference in New Issue
Block a user