update ETA resolvers

This commit is contained in:
2025-04-06 12:44:23 -07:00
parent 7136f9201d
commit f113dc1ec2

View File

@@ -4,10 +4,18 @@ import { ServerContext } from "../ServerContext";
export const EtaResolvers: Resolvers<ServerContext> = {
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);
},
},
}