mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-16 23:40:32 +00:00
add shuttles resolver on route
This commit is contained in:
@@ -88,6 +88,20 @@ export const resolvers: Resolvers<ServerContext> = {
|
||||
}
|
||||
},
|
||||
Route: {
|
||||
shuttles: async (parent, args, contextValue, info) => {
|
||||
const shuttles = await contextValue.repository.getShuttlesByRouteId(parent.id);
|
||||
|
||||
return shuttles.map(({
|
||||
coordinates,
|
||||
name,
|
||||
id,
|
||||
}) => ({
|
||||
coordinates: coordinates as Coordinates,
|
||||
name,
|
||||
route: parent,
|
||||
id,
|
||||
}));
|
||||
}
|
||||
},
|
||||
Shuttle: {
|
||||
eta: (parent, args, contextValue, info) => {
|
||||
|
||||
Reference in New Issue
Block a user