mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
update stop resolvers to look for system
This commit is contained in:
@@ -3,11 +3,19 @@ import { ServerContext } from "../ServerContext";
|
|||||||
|
|
||||||
export const StopResolvers: Resolvers<ServerContext> = {
|
export const StopResolvers: Resolvers<ServerContext> = {
|
||||||
Stop: {
|
Stop: {
|
||||||
orderedStops: async (parent, args, contextValue, info) => {
|
orderedStops: async (parent, args, contextValue, _info) => {
|
||||||
return await contextValue.shuttleRepository.getOrderedStopsByStopId(parent.id);
|
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) => {
|
etas: async (parent, args, contextValue, _info) => {
|
||||||
return await contextValue.shuttleRepository.getEtasForStopId(parent.id);
|
const system = contextValue.systems.find((system) => system.id === parent.id);
|
||||||
|
if (!system) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return await system.shuttleRepository.getEtasForStopId(parent.id);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user