mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
update ETA resolvers
This commit is contained in:
@@ -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);
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user