mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
Subscribe to shuttle events and add stub methods
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { SelfUpdatingETARepository } from "./SelfUpdatingETARepository";
|
||||
import { BaseRedisETARepository } from "./BaseRedisETARepository";
|
||||
import { createClient, RedisClientType } from "redis";
|
||||
import { ShuttleGetterRepository, ShuttleTravelTimeDataIdentifier, ShuttleTravelTimeDateFilterArguments } from "../ShuttleGetterRepository";
|
||||
import { ShuttleGetterRepository, ShuttleRepositoryEvent, ShuttleStopArrival, ShuttleTravelTimeDataIdentifier, ShuttleTravelTimeDateFilterArguments } from "../ShuttleGetterRepository";
|
||||
import { REDIS_RECONNECT_INTERVAL } from "../../../environment";
|
||||
import { IShuttle } from "../../../entities/ShuttleRepositoryEntities";
|
||||
|
||||
export class RedisSelfUpdatingETARepository extends BaseRedisETARepository implements SelfUpdatingETARepository {
|
||||
constructor(
|
||||
@@ -23,7 +24,21 @@ export class RedisSelfUpdatingETARepository extends BaseRedisETARepository imple
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
|
||||
startListeningForUpdates(): void {
|
||||
throw new Error("Method not implemented.");
|
||||
startListeningForUpdates() {
|
||||
this.shuttleRepository.addListener(ShuttleRepositoryEvent.SHUTTLE_UPDATED, this.handleShuttleUpdate);
|
||||
this.shuttleRepository.addListener(ShuttleRepositoryEvent.SHUTTLE_ARRIVED_AT_STOP, this.handleShuttleArriveAtStop)
|
||||
}
|
||||
|
||||
stopListeningForUpdates() {
|
||||
this.shuttleRepository.removeListener(ShuttleRepositoryEvent.SHUTTLE_UPDATED, this.handleShuttleUpdate);
|
||||
this.shuttleRepository.removeListener(ShuttleRepositoryEvent.SHUTTLE_ARRIVED_AT_STOP, this.handleShuttleArriveAtStop);
|
||||
}
|
||||
|
||||
private handleShuttleUpdate(shuttle: IShuttle) {
|
||||
// TODO: handle shuttle update
|
||||
}
|
||||
|
||||
private handleShuttleArriveAtStop(shuttleArrival: ShuttleStopArrival) {
|
||||
// TODO: handle shuttle arrive at stop
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user