mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-16 23:40:32 +00:00
Remove unused ETA code from RedisShuttleRepository
This commit is contained in:
@@ -87,7 +87,6 @@ export class RedisShuttleRepository extends BaseRedisRepository implements Shutt
|
||||
private createStopKey = (stopId: string) => `shuttle:stop:${stopId}`;
|
||||
private createRouteKey = (routeId: string) => `shuttle:route:${routeId}`;
|
||||
private createShuttleKey = (shuttleId: string) => `shuttle:shuttle:${shuttleId}`;
|
||||
private createEtaKey = (shuttleId: string, stopId: string) => `shuttle:eta:${shuttleId}:${stopId}`;
|
||||
private createOrderedStopKey = (routeId: string, stopId: string) => `shuttle:orderedstop:${routeId}:${stopId}`;
|
||||
private createShuttleLastStopKey = (shuttleId: string) => `shuttle:laststop:${shuttleId}`;
|
||||
private createHistoricalEtaTimeSeriesKey = (routeId: string, fromStopId: string, toStopId: string) => {
|
||||
@@ -308,45 +307,6 @@ export class RedisShuttleRepository extends BaseRedisRepository implements Shutt
|
||||
return this.createShuttleFromRedisData(data);
|
||||
}
|
||||
|
||||
public async getEtasForShuttleId(shuttleId: string): Promise<IEta[]> {
|
||||
const keys = await this.redisClient.keys(`shuttle:eta:${shuttleId}:*`);
|
||||
const etas: IEta[] = [];
|
||||
|
||||
for (const key of keys) {
|
||||
const data = await this.redisClient.hGetAll(key);
|
||||
if (Object.keys(data).length > 0) {
|
||||
etas.push(this.createEtaFromRedisData(data));
|
||||
}
|
||||
}
|
||||
|
||||
return etas;
|
||||
}
|
||||
|
||||
public async getEtasForStopId(stopId: string): Promise<IEta[]> {
|
||||
const keys = await this.redisClient.keys('shuttle:eta:*');
|
||||
const etas: IEta[] = [];
|
||||
|
||||
for (const key of keys) {
|
||||
const data = await this.redisClient.hGetAll(key);
|
||||
if (Object.keys(data).length > 0 && data.stopId === stopId) {
|
||||
etas.push(this.createEtaFromRedisData(data));
|
||||
}
|
||||
}
|
||||
|
||||
return etas;
|
||||
}
|
||||
|
||||
public async getEtaForShuttleAndStopId(shuttleId: string, stopId: string): Promise<IEta | null> {
|
||||
const key = this.createEtaKey(shuttleId, stopId);
|
||||
const data = await this.redisClient.hGetAll(key);
|
||||
|
||||
if (Object.keys(data).length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.createEtaFromRedisData(data);
|
||||
}
|
||||
|
||||
public async getOrderedStopByRouteAndStopId(routeId: string, stopId: string): Promise<IOrderedStop | null> {
|
||||
const key = this.createOrderedStopKey(routeId, stopId);
|
||||
const data = await this.redisClient.hGetAll(key);
|
||||
|
||||
Reference in New Issue
Block a user