add a RepositoryLoader interface defining a fetchAndUpdateAll method

This commit is contained in:
2025-04-11 16:43:46 -07:00
parent 49b823890f
commit 16dce32887
3 changed files with 17 additions and 1 deletions

View File

@@ -28,6 +28,17 @@ export class ApiBasedShuttleRepositoryLoader implements ShuttleRepositoryLoader
return ids; return ids;
} }
public async fetchAndUpdateAll() {
await this.fetchAndUpdateRouteDataForSystem();
await this.fetchAndUpdateStopAndPolylineDataForRoutesInSystem();
await this.fetchAndUpdateShuttleDataForSystem();
// Because ETA method doesn't support pruning yet,
// add a call to the clear method here
await this.repository.clearEtaData();
await this.fetchAndUpdateEtaDataForExistingStopsForSystem();
}
public async fetchAndUpdateRouteDataForSystem() { public async fetchAndUpdateRouteDataForSystem() {
const systemId = this.passioSystemId; const systemId = this.passioSystemId;
const routeIdsToPrune = await this.constructExistingEntityIdSet(async () => { const routeIdsToPrune = await this.constructExistingEntityIdSet(async () => {

View File

@@ -0,0 +1,3 @@
export interface RepositoryLoader {
fetchAndUpdateAll(): Promise<void>;
}

View File

@@ -1,4 +1,6 @@
export interface ShuttleRepositoryLoader { import { RepositoryLoader } from "./RepositoryLoader";
export interface ShuttleRepositoryLoader extends RepositoryLoader {
fetchAndUpdateRouteDataForSystem(): Promise<void>; fetchAndUpdateRouteDataForSystem(): Promise<void>;
fetchAndUpdateStopAndPolylineDataForRoutesInSystem(): Promise<void>; fetchAndUpdateStopAndPolylineDataForRoutesInSystem(): Promise<void>;
fetchAndUpdateShuttleDataForSystem(): Promise<void>; fetchAndUpdateShuttleDataForSystem(): Promise<void>;