// Mock data import { IEta, IOrderedStop, IRoute, IShuttle, IStop, ISystem, Repository } from "./repository"; const systems: ISystem[] = [ { id: "1", name: "Chapman University", }, ]; const routes: IRoute[] = [ { name: "Red Route", id: "1", systemId: systems[0].id, polylineCoordinates: [], color: "#db2316", }, { name: "Teal Route", id: "2", systemId: systems[0].id, polylineCoordinates: [], color: "#21bdd1", }, ]; const stops: IStop[] = [ { id: "1", name: "Chapman Court", coordinates: { latitude: 33.796001, longitude: -117.8892805, }, systemId: systems[0].id, }, { id: "2", name: "Chapman Grand", coordinates: { latitude: 33.804433, longitude: -117.895966, }, systemId: systems[0].id, } ]; const orderedStopsForRedRoute: IOrderedStop[] = [ { routeId: routes[0].id, stopId: stops[0].id, position: 1, }, { routeId: routes[0].id, stopId: stops[1].id, position: 2, }, ]; const orderedStopsForTealRoute: IOrderedStop[] = [ { routeId: routes[1].id, stopId: stops[1].id, position: 1, }, { routeId: routes[1].id, stopId: stops[0].id, position: 2, }, ] orderedStopsForRedRoute[0].nextStop = orderedStopsForRedRoute[1]; orderedStopsForRedRoute[1].previousStop = orderedStopsForRedRoute[0]; orderedStopsForTealRoute[0].nextStop = orderedStopsForTealRoute[1]; orderedStopsForTealRoute[1].previousStop = orderedStopsForTealRoute[0]; const shuttles: IShuttle[] = [ { name: "Red Shuttle 17", id: "1", coordinates: { latitude: 33.796001, longitude: -117.8892805, }, routeId: routes[0].id, systemId: systems[0].id, } ]; const etas: IEta[] = [ { stopId: stops[0].id, shuttleId: shuttles[0].id, secondsRemaining: 12.023, }, { stopId: stops[1].id, shuttleId: shuttles[0].id, secondsRemaining: 600.123, } ]; export async function loadTestData(repository: Repository) { await Promise.all(systems.map(async (system) => { await repository.addOrUpdateSystem(system); })); await Promise.all(routes.map(async (route) => { await repository.addOrUpdateRoute(route); })); await Promise.all(shuttles.map(async (shuttle) => { await repository.addOrUpdateShuttle(shuttle); })); await Promise.all(stops.map(async (stop) => { await repository.addOrUpdateStop(stop); })); await Promise.all(orderedStopsForRedRoute.map(async (orderedStop) => { await repository.addOrUpdateOrderedStop(orderedStop); })); await Promise.all(orderedStopsForTealRoute.map(async (orderedStop) => { await repository.addOrUpdateOrderedStop(orderedStop); })); await Promise.all(etas.map(async (eta) => { await repository.addOrUpdateEta(eta); })); }