update stop resolvers to look for system

This commit is contained in:
2025-04-06 11:30:08 -07:00
parent 472b3a0b05
commit ea4723df85

View File

@@ -3,11 +3,19 @@ import { ServerContext } from "../ServerContext";
export const StopResolvers: Resolvers<ServerContext> = {
Stop: {
orderedStops: async (parent, args, contextValue, info) => {
return await contextValue.shuttleRepository.getOrderedStopsByStopId(parent.id);
orderedStops: async (parent, args, contextValue, _info) => {
const system = contextValue.systems.find((system) => system.id === parent.id);
if (!system) {
return [];
}
return await system.shuttleRepository.getOrderedStopsByStopId(parent.id);
},
etas: async (parent, args, contextValue, info) => {
return await contextValue.shuttleRepository.getEtasForStopId(parent.id);
etas: async (parent, args, contextValue, _info) => {
const system = contextValue.systems.find((system) => system.id === parent.id);
if (!system) {
return [];
}
return await system.shuttleRepository.getEtasForStopId(parent.id);
},
},
}