mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
write logic to get eta for shuttle and stop id
This commit is contained in:
@@ -40,6 +40,20 @@ export class ApiBasedRepository implements GetterRepository {
|
||||
}
|
||||
|
||||
public async getEtaForShuttleAndStopId(shuttleId: string, stopId: string): Promise<IEta | null> {
|
||||
const shuttle = await this.getShuttleById(shuttleId);
|
||||
const systemId = shuttle?.systemId;
|
||||
if (!systemId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (this.initialCache?.etasForStopId !== undefined) {
|
||||
const etas = this.initialCache.etasForStopId[systemId];
|
||||
const foundEta = etas.find((eta) => eta.stopId === stopId);
|
||||
if (foundEta) {
|
||||
return foundEta;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -76,7 +90,7 @@ export class ApiBasedRepository implements GetterRepository {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
public async getShuttleById(shuttleId: string): Promise<| null> {
|
||||
public async getShuttleById(shuttleId: string): Promise<IShuttle | null> {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user