mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add implementation for getEtasForStopId and getEtasForShuttleId
This commit is contained in:
@@ -84,12 +84,34 @@ export class ApiBasedRepository implements GetterRepository {
|
||||
return null;
|
||||
}
|
||||
|
||||
public async getEtasForShuttleId(shuttleId: string): Promise<[]> {
|
||||
return [];
|
||||
public async getEtasForShuttleId(shuttleId: string): Promise<IEta[]> {
|
||||
const shuttle = await this.getShuttleById(shuttleId);
|
||||
const systemId = shuttle?.systemId;
|
||||
if (!systemId) {
|
||||
return [];
|
||||
}
|
||||
await this.updateEtasForSystemIfTTL(systemId);
|
||||
|
||||
if (!this.cache?.etasForShuttleId || !this.cache.etasForShuttleId[shuttleId]) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return this.cache.etasForShuttleId[shuttleId];
|
||||
}
|
||||
|
||||
public async getEtasForStopId(stopId: string): Promise<[]> {
|
||||
return [];
|
||||
public async getEtasForStopId(stopId: string): Promise<IEta[]> {
|
||||
const stop = await this.getStopById(stopId);
|
||||
const systemId = stop?.systemId;
|
||||
if (!systemId) {
|
||||
return [];
|
||||
}
|
||||
await this.updateEtasForSystemIfTTL(systemId);
|
||||
|
||||
if (!this.cache?.etasForStopId || !this.cache.etasForStopId[stopId]) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return this.cache.etasForStopId[stopId];
|
||||
}
|
||||
|
||||
public async updateEtasForSystemIfTTL(systemId: string) {
|
||||
@@ -262,7 +284,8 @@ ${json}`);
|
||||
}
|
||||
}
|
||||
|
||||
public async getStopById(stopId: string): Promise<| null> {
|
||||
public async getStopById(stopId: string): Promise<IStop | null> {
|
||||
// TODO: implement
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user