mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add shuttles resolver on route
This commit is contained in:
@@ -88,6 +88,20 @@ export const resolvers: Resolvers<ServerContext> = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
Route: {
|
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: {
|
Shuttle: {
|
||||||
eta: (parent, args, contextValue, info) => {
|
eta: (parent, args, contextValue, info) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user