mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-19 08:50:29 +00:00
Update resolvers to use the ETA repository
This commit is contained in:
@@ -9,7 +9,7 @@ export const ShuttleResolvers: Resolvers<ServerContext> = {
|
|||||||
const system = contextValue.findSystemById(parent.systemId);
|
const system = contextValue.findSystemById(parent.systemId);
|
||||||
if (!system) return null;
|
if (!system) return null;
|
||||||
|
|
||||||
const etaForStopId = await system.shuttleRepository.getEtaForShuttleAndStopId(parent.id, args.forStopId);
|
const etaForStopId = await system.etaRepository.getEtaForShuttleAndStopId(parent.id, args.forStopId);
|
||||||
if (etaForStopId === null) return null;
|
if (etaForStopId === null) return null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -25,7 +25,7 @@ export const ShuttleResolvers: Resolvers<ServerContext> = {
|
|||||||
const system = contextValue.findSystemById(parent.systemId);
|
const system = contextValue.findSystemById(parent.systemId);
|
||||||
if (!system) return null;
|
if (!system) return null;
|
||||||
|
|
||||||
const etasForShuttle = await system.shuttleRepository.getEtasForShuttleId(parent.id);
|
const etasForShuttle = await system.etaRepository.getEtasForShuttleId(parent.id);
|
||||||
if (!etasForShuttle) return null;
|
if (!etasForShuttle) return null;
|
||||||
|
|
||||||
const computedEtas = await Promise.all(
|
const computedEtas = await Promise.all(
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export const StopResolvers: Resolvers<ServerContext> = {
|
|||||||
if (!system) {
|
if (!system) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const etas = await system.shuttleRepository.getEtasForStopId(parent.id);
|
const etas = await system.etaRepository.getEtasForStopId(parent.id);
|
||||||
return etas.slice().sort((a, b) => a.secondsRemaining - b.secondsRemaining);
|
return etas.slice().sort((a, b) => a.secondsRemaining - b.secondsRemaining);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user