add bindings for the notifications repository

This commit is contained in:
2025-03-27 11:34:01 -07:00
parent a84cedd05a
commit 9c22e154be

View File

@@ -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({