update test data with etas

This commit is contained in:
2024-12-22 19:59:20 -08:00
parent f615db544d
commit 0133acd900

View File

@@ -1,5 +1,5 @@
// Mock data
import { IOrderedStop, IRoute, IShuttle, IStop, ISystem, Repository } from "./repository";
import { IEta, IOrderedStop, IRoute, IShuttle, IStop, ISystem, Repository } from "./repository";
const systems: ISystem[] = [
{
@@ -86,30 +86,18 @@ const shuttles: IShuttle[] = [
}
];
// const etas: Eta[] = [
// {
// stop: stops[0],
// shuttle: shuttles[0],
// secondsRemaining: 12.023,
// },
// {
// stop: stops[1],
// shuttle: shuttles[0],
// secondsRemaining: 600.123,
// }
// ];
// shuttles[0].etas = etas;
//
// routes[0].shuttles = shuttles;
//
// systems[0].stops = stops;
// systems[0].routes = routes;
// systems[0].shuttles = shuttles;
// export function loadTestData(sharedMemory: SharedMemory) {
// sharedMemory.systems = systems;
// }
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) => {
@@ -130,4 +118,7 @@ export async function loadTestData(repository: Repository) {
await Promise.all(orderedStopsForTealRoute.map(async (orderedStop) => {
await repository.addOrUpdateOrderedStop(orderedStop);
}));
await Promise.all(etas.map(async (eta) => {
await repository.addOrUpdateEta(eta);
}));
}