diff --git a/src/repositories/shuttle/ShuttleGetterRepository.ts b/src/repositories/shuttle/ShuttleGetterRepository.ts index a0e9f7f..44bb872 100644 --- a/src/repositories/shuttle/ShuttleGetterRepository.ts +++ b/src/repositories/shuttle/ShuttleGetterRepository.ts @@ -4,6 +4,7 @@ import type EventEmitter from "node:events"; export const ShuttleRepositoryEvent = { SHUTTLE_UPDATED: "shuttleUpdated", SHUTTLE_REMOVED: "shuttleRemoved", + SHUTTLE_ARRIVED_AT_STOP: "shuttleArrivedAtStop", } as const; export type ShuttleRepositoryEventName = typeof ShuttleRepositoryEvent[keyof typeof ShuttleRepositoryEvent]; @@ -14,6 +15,7 @@ export type EtaDataClearedEventPayload = IEta[]; export interface ShuttleRepositoryEventPayloads { [ShuttleRepositoryEvent.SHUTTLE_UPDATED]: IShuttle, [ShuttleRepositoryEvent.SHUTTLE_REMOVED]: IShuttle, + [ShuttleRepositoryEvent.SHUTTLE_ARRIVED_AT_STOP]: ShuttleStopArrival, } export type ShuttleRepositoryEventListener = ( @@ -21,6 +23,7 @@ export type ShuttleRepositoryEventListener ) => void; export interface ShuttleStopArrival { + shuttleId: string; stopId: string; timestamp: Date; } @@ -50,10 +53,6 @@ export interface ShuttleGetterRepository extends EventEmitter { getShuttleById(shuttleId: string): Promise; getShuttlesByRouteId(routeId: string): Promise; - getEtasForShuttleId(shuttleId: string): Promise; - getEtasForStopId(stopId: string): Promise; - getEtaForShuttleAndStopId(shuttleId: string, stopId: string): Promise; - on(event: T, listener: ShuttleRepositoryEventListener): this; once(event: T, listener: ShuttleRepositoryEventListener): this; off(event: T, listener: ShuttleRepositoryEventListener): this;