simplify stops resolver to one statement

This commit is contained in:
2025-01-28 20:38:17 -08:00
parent fe705ed8e3
commit 3fca362c14

View File

@@ -7,17 +7,7 @@ export const SystemResolvers: Resolvers<ServerContext> = {
return await contextValue.repository.getRoutesBySystemId(parent.id);
},
stops: async (parent, args, contextValue, info) => {
const stops = 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,
}));
return await contextValue.repository.getStopsBySystemId(parent.id);
},
stop: async (parent, args, contextValue, info) => {
if (!args.id) return null;