diff --git a/src/repositories/shuttle/RedisShuttleRepository.ts b/src/repositories/shuttle/RedisShuttleRepository.ts index 8d20e9c..a18ca58 100644 --- a/src/repositories/shuttle/RedisShuttleRepository.ts +++ b/src/repositories/shuttle/RedisShuttleRepository.ts @@ -486,7 +486,7 @@ export class RedisShuttleRepository extends EventEmitter implements ShuttleGette await this.addTravelTimeDataPoint({ routeId, fromStopId, toStopId, }, travelTimeSeconds, travelTimeTimestamp); } - await this.updateShuttleLastStopArrival(shuttle, { + await this.updateShuttleLastStopArrival(shuttle.id, { stopId: arrivedStop.id, timestamp: new Date(travelTimeTimestamp), }) @@ -626,8 +626,8 @@ export class RedisShuttleRepository extends EventEmitter implements ShuttleGette }; } - public async updateShuttleLastStopArrival(shuttle: IShuttle, lastStopArrival: ShuttleStopArrival) { - const key = this.createShuttleLastStopKey(shuttle.id); + public async updateShuttleLastStopArrival(shuttleId: string, lastStopArrival: ShuttleStopArrival) { + const key = this.createShuttleLastStopKey(shuttleId); await this.redisClient.hSet(key, { stopId: lastStopArrival.stopId, timestamp: lastStopArrival.timestamp.toISOString(), diff --git a/src/repositories/shuttle/__tests__/RedisShuttleRepository.test.ts b/src/repositories/shuttle/__tests__/RedisShuttleRepository.test.ts index b99a5cb..9cb2220 100644 --- a/src/repositories/shuttle/__tests__/RedisShuttleRepository.test.ts +++ b/src/repositories/shuttle/__tests__/RedisShuttleRepository.test.ts @@ -212,7 +212,7 @@ describe("RedisShuttleRepository", () => { timestamp: new Date("2024-01-15T10:30:00Z"), }; - await repository.updateShuttleLastStopArrival(shuttle, stopArrival); + await repository.updateShuttleLastStopArrival(shuttle.id, stopArrival); const result = await repository.getShuttleLastStopArrival(shuttle.id); expect(result).toBeDefined(); @@ -243,8 +243,8 @@ describe("RedisShuttleRepository", () => { timestamp: new Date("2024-01-15T10:35:00Z"), }; - await repository.updateShuttleLastStopArrival(shuttle, firstArrival); - await repository.updateShuttleLastStopArrival(shuttle, secondArrival); + await repository.updateShuttleLastStopArrival(shuttle.id, firstArrival); + await repository.updateShuttleLastStopArrival(shuttle.id, secondArrival); const result = await repository.getShuttleLastStopArrival(shuttle.id);