From f113dc1ec2f0cecba46b80716329075de01b1920 Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Sun, 6 Apr 2025 12:44:23 -0700 Subject: [PATCH] update ETA resolvers --- src/resolvers/EtaResolvers.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/resolvers/EtaResolvers.ts b/src/resolvers/EtaResolvers.ts index b5e7c65..0dabe62 100644 --- a/src/resolvers/EtaResolvers.ts +++ b/src/resolvers/EtaResolvers.ts @@ -4,10 +4,18 @@ import { ServerContext } from "../ServerContext"; export const EtaResolvers: Resolvers = { ETA: { stop: async (parent, args, contextValue, info) => { - return await contextValue.shuttleRepository.getStopById(parent.stopId); + if (!parent.shuttle) return null; + const system = contextValue.findSystemById(parent.shuttle.systemId); + if (!system) return null; + + return await system.shuttleRepository.getStopById(parent.stopId); }, shuttle: async (parent, args, contextValue, info) => { - return await contextValue.shuttleRepository.getShuttleById(parent.shuttleId); + if (!parent.stop) return null; + const system = contextValue.findSystemById(parent.stop.systemId); + if (!system) return null; + + return await system.shuttleRepository.getShuttleById(parent.shuttleId); }, }, }