mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
Make checkIfShuttleIsAtStop part of the ShuttleGetterRepository interface
This commit is contained in:
@@ -447,7 +447,7 @@ export class RedisShuttleRepository extends BaseRedisRepository implements Shutt
|
|||||||
await this.redisClient.sRem(this.shuttleIsAtStopKey, shuttleId);
|
await this.redisClient.sRem(this.shuttleIsAtStopKey, shuttleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async checkIfShuttleIsAtStop(shuttleId: string) {
|
public async checkIfShuttleIsAtStop(shuttleId: string) {
|
||||||
return await this.redisClient.sIsMember(this.shuttleIsAtStopKey, shuttleId);
|
return await this.redisClient.sIsMember(this.shuttleIsAtStopKey, shuttleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,14 @@ export interface ShuttleGetterRepository extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
getShuttleLastStopArrival(shuttleId: string): Promise<ShuttleStopArrival | undefined>;
|
getShuttleLastStopArrival(shuttleId: string): Promise<ShuttleStopArrival | undefined>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if the shuttle is currently at a stop.
|
||||||
|
* If `true`, then calling `getShuttleLastStopArrival` will get
|
||||||
|
* the stop the shuttle is currently at.
|
||||||
|
* @param shuttleId
|
||||||
|
*/
|
||||||
|
checkIfShuttleIsAtStop(shuttleId: string): Promise<boolean>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a shuttle has arrived at a stop within the given delta.
|
* Check if a shuttle has arrived at a stop within the given delta.
|
||||||
* Returns the stop if the shuttle is at a stop, otherwise undefined.
|
* Returns the stop if the shuttle is at a stop, otherwise undefined.
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ export class UnoptimizedInMemoryShuttleRepository
|
|||||||
this.shuttlesAtStop.delete(shuttleId);
|
this.shuttlesAtStop.delete(shuttleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async checkIfShuttleIsAtStop(shuttleId: string) {
|
public async checkIfShuttleIsAtStop(shuttleId: string) {
|
||||||
return this.shuttlesAtStop.has(shuttleId);
|
return this.shuttlesAtStop.has(shuttleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user