From ea4723df856386c6955cf2a899d68d9e12f7bf09 Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Sun, 6 Apr 2025 11:30:08 -0700 Subject: [PATCH] update stop resolvers to look for system --- src/resolvers/StopResolvers.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/resolvers/StopResolvers.ts b/src/resolvers/StopResolvers.ts index 860e3be..9a2b55a 100644 --- a/src/resolvers/StopResolvers.ts +++ b/src/resolvers/StopResolvers.ts @@ -3,11 +3,19 @@ import { ServerContext } from "../ServerContext"; export const StopResolvers: Resolvers = { 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); }, }, }