mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add orderedStop property for Route
This commit is contained in:
@@ -110,7 +110,24 @@ export const resolvers: Resolvers<ServerContext> = {
|
||||
route: parent,
|
||||
id,
|
||||
}));
|
||||
}
|
||||
},
|
||||
orderedStop: async (parent, args, contextValue, info) => {
|
||||
if (!args.forStopId) return null;
|
||||
const orderedStop = await contextValue.repository.getOrderedStopByRouteAndStopId(parent.id, args.forStopId);
|
||||
if (!orderedStop) return null;
|
||||
|
||||
const stop = await contextValue.repository.getStopById(orderedStop.stopId);
|
||||
if (!stop) return null;
|
||||
|
||||
return {
|
||||
stop: {
|
||||
id: stop.id,
|
||||
name: stop.name,
|
||||
coordinates: stop.coordinates as Coordinates,
|
||||
},
|
||||
route: parent,
|
||||
}
|
||||
},
|
||||
},
|
||||
Shuttle: {
|
||||
eta: async (parent, args, contextValue, info) => {
|
||||
|
||||
Reference in New Issue
Block a user