mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
update test data with etas
This commit is contained in:
@@ -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);
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user