add notification repository as optional dependency

This commit is contained in:
2025-03-27 10:20:25 -07:00
parent f007b72d94
commit fb58414ba3

View File

@@ -2,14 +2,21 @@ import { ShuttleGetterRepository } from "../../repositories/ShuttleGetterReposit
import { TupleKey } from "../../types/TupleKey";
import { IEta } from "../../entities/entities";
import { AppleNotificationSender, NotificationAlertArguments } from "../senders/AppleNotificationSender";
import { NotificationLookupArguments, ScheduledNotification } from "../../repositories/NotificationRepository";
import {
NotificationLookupArguments,
NotificationRepository,
ScheduledNotification
} from "../../repositories/NotificationRepository";
import { InMemoryNotificationRepository } from "../../repositories/InMemoryNotificationRepository";
type DeviceIdSecondsThresholdAssociation = { [key: string]: number };
export class ETANotificationScheduler {
public static readonly defaultSecondsThresholdForNotificationToFire = 180;
constructor(private shuttleRepository: ShuttleGetterRepository,
constructor(
private shuttleRepository: ShuttleGetterRepository,
private notificationRepository: NotificationRepository = new InMemoryNotificationRepository(),
private appleNotificationSender = new AppleNotificationSender()
) {
this.etaSubscriberCallback = this.etaSubscriberCallback.bind(this);