mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
simplify stops resolver to one statement
This commit is contained in:
@@ -7,17 +7,7 @@ export const SystemResolvers: Resolvers<ServerContext> = {
|
|||||||
return await contextValue.repository.getRoutesBySystemId(parent.id);
|
return await contextValue.repository.getRoutesBySystemId(parent.id);
|
||||||
},
|
},
|
||||||
stops: async (parent, args, contextValue, info) => {
|
stops: async (parent, args, contextValue, info) => {
|
||||||
const stops = await contextValue.repository.getStopsBySystemId(parent.id);
|
return await contextValue.repository.getStopsBySystemId(parent.id);
|
||||||
return stops.map(({
|
|
||||||
id,
|
|
||||||
name,
|
|
||||||
coordinates
|
|
||||||
}) => ({
|
|
||||||
id,
|
|
||||||
name,
|
|
||||||
// Both ICoordinates and Coordinates have the same definition
|
|
||||||
coordinates: coordinates as Coordinates,
|
|
||||||
}));
|
|
||||||
},
|
},
|
||||||
stop: async (parent, args, contextValue, info) => {
|
stop: async (parent, args, contextValue, info) => {
|
||||||
if (!args.id) return null;
|
if (!args.id) return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user