"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.resolvers = void 0; // Mock data const systems = [ { id: "1", name: "Chapman University", routes: [], stops: [], shuttles: [], }, ]; const routes = [ { name: "Red Route", id: "1", system: systems[0], orderedStops: [], shuttles: [], polylineCoordinates: [], color: "#ffffff", }, { name: "Teal Route", id: "2", system: systems[0], orderedStops: [], shuttles: [], polylineCoordinates: [], color: "#ffffff", }, ]; const stops = [ { id: "1", name: "Chapman Court", coordinates: { latitude: 33.796001, longitude: -117.8892805, }, system: systems[0], etas: [], orderedStops: [], }, { id: "2", name: "Chapman Grand", coordinates: { latitude: 33.804433, longitude: -117.895966, }, system: systems[0], etas: [], orderedStops: [], } ]; const orderedStopsForRedRoute = [ { route: routes[0], stop: stops[0], }, { route: routes[0], stop: stops[1], }, ]; const orderedStopsForTealRoute = [ { route: routes[1], stop: stops[1], }, { route: routes[1], stop: stops[0], } ]; orderedStopsForRedRoute[0].nextStop = orderedStopsForRedRoute[1]; orderedStopsForRedRoute[1].previousStop = orderedStopsForRedRoute[0]; orderedStopsForTealRoute[0].nextStop = orderedStopsForTealRoute[1]; orderedStopsForTealRoute[1].previousStop = orderedStopsForTealRoute[0]; stops[0].orderedStops = [orderedStopsForRedRoute[0], orderedStopsForTealRoute[1]]; stops[1].orderedStops = [orderedStopsForRedRoute[1], orderedStopsForTealRoute[0]]; routes[0].orderedStops = orderedStopsForRedRoute; routes[1].orderedStops = orderedStopsForTealRoute; const shuttles = [ { name: "Red Shuttle 17", id: "1", coordinates: { latitude: 33.796001, longitude: -117.8892805, }, route: routes[0], system: systems[0], etas: [], } ]; const etas = [ { 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; exports.resolvers = { Query: { systems: () => systems, system: (parent, args, contextValue, info) => { const system = systems.find((system) => system.id === args.id); if (!system) { return null; } return system; } }, System: { stop: (parent, args, contextValue, info) => { const stop = stops.find((stop) => stop.id === args.id); if (!stop) { return null; } return stop; }, route: (parent, args, contextValue, info) => { const route = routes.find((route) => route.id === args.id); if (!route) { return null; } return route; }, shuttle: (parent, args, contextValue, info) => { const shuttle = shuttles.find((shuttle) => shuttle.id === args.id); if (!shuttle) { return null; } return shuttle; } }, Route: { nextOrderedStop: (parent, args, contextValue, info) => { const orderedStop = parent.orderedStops.find((orderedStop) => orderedStop.stop.id === args.forStopId); if (!orderedStop || !orderedStop.nextStop) { return null; } return orderedStop.nextStop; }, }, Shuttle: { eta: (parent, args, contextValue, info) => { const etaForNextStop = parent.etas.find((eta) => eta.stop.id === args.forStopId); if (!etaForNextStop) { return null; } return etaForNextStop; }, }, };