mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add a RepositoryLoader interface defining a fetchAndUpdateAll method
This commit is contained in:
@@ -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 () => {
|
||||||
|
|||||||
3
src/loaders/RepositoryLoader.ts
Normal file
3
src/loaders/RepositoryLoader.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export interface RepositoryLoader {
|
||||||
|
fetchAndUpdateAll(): Promise<void>;
|
||||||
|
}
|
||||||
@@ -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>;
|
||||||
|
|||||||
Reference in New Issue
Block a user