mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add notification repository as optional dependency
This commit is contained in:
@@ -2,15 +2,22 @@ import { ShuttleGetterRepository } from "../../repositories/ShuttleGetterReposit
|
|||||||
import { TupleKey } from "../../types/TupleKey";
|
import { TupleKey } from "../../types/TupleKey";
|
||||||
import { IEta } from "../../entities/entities";
|
import { IEta } from "../../entities/entities";
|
||||||
import { AppleNotificationSender, NotificationAlertArguments } from "../senders/AppleNotificationSender";
|
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 };
|
type DeviceIdSecondsThresholdAssociation = { [key: string]: number };
|
||||||
|
|
||||||
export class ETANotificationScheduler {
|
export class ETANotificationScheduler {
|
||||||
public static readonly defaultSecondsThresholdForNotificationToFire = 180;
|
public static readonly defaultSecondsThresholdForNotificationToFire = 180;
|
||||||
|
|
||||||
constructor(private shuttleRepository: ShuttleGetterRepository,
|
constructor(
|
||||||
private appleNotificationSender = new AppleNotificationSender()
|
private shuttleRepository: ShuttleGetterRepository,
|
||||||
|
private notificationRepository: NotificationRepository = new InMemoryNotificationRepository(),
|
||||||
|
private appleNotificationSender = new AppleNotificationSender()
|
||||||
) {
|
) {
|
||||||
this.etaSubscriberCallback = this.etaSubscriberCallback.bind(this);
|
this.etaSubscriberCallback = this.etaSubscriberCallback.bind(this);
|
||||||
this.sendEtaNotificationImmediately = this.sendEtaNotificationImmediately.bind(this);
|
this.sendEtaNotificationImmediately = this.sendEtaNotificationImmediately.bind(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user