mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add system ID as parent ID in system resolvers
This commit is contained in:
@@ -3,7 +3,7 @@ import { ServerContext } from "../ServerContext";
|
|||||||
|
|
||||||
export const SystemResolvers: Resolvers<ServerContext> = {
|
export const SystemResolvers: Resolvers<ServerContext> = {
|
||||||
System: {
|
System: {
|
||||||
routes: async (parent, args, contextValue, info) => {
|
routes: async (parent, args, contextValue, _info) => {
|
||||||
const system = contextValue.systems.find((system) => system.id === parent.id);
|
const system = contextValue.systems.find((system) => system.id === parent.id);
|
||||||
if (!system) {
|
if (!system) {
|
||||||
return [];
|
return [];
|
||||||
@@ -11,7 +11,7 @@ export const SystemResolvers: Resolvers<ServerContext> = {
|
|||||||
|
|
||||||
return await system.shuttleRepository.getRoutesBySystemId(parent.id);
|
return await system.shuttleRepository.getRoutesBySystemId(parent.id);
|
||||||
},
|
},
|
||||||
stops: async (parent, args, contextValue, info) => {
|
stops: async (parent, args, contextValue, _info) => {
|
||||||
const system = contextValue.systems.find((system) => system.id === parent.id);
|
const system = contextValue.systems.find((system) => system.id === parent.id);
|
||||||
if (!system) {
|
if (!system) {
|
||||||
return [];
|
return [];
|
||||||
@@ -19,7 +19,7 @@ export const SystemResolvers: Resolvers<ServerContext> = {
|
|||||||
|
|
||||||
return await system.shuttleRepository.getStopsBySystemId(parent.id);
|
return await system.shuttleRepository.getStopsBySystemId(parent.id);
|
||||||
},
|
},
|
||||||
stop: async (parent, args, contextValue, info) => {
|
stop: async (parent, args, contextValue, _info) => {
|
||||||
if (!args.id) return null;
|
if (!args.id) return null;
|
||||||
const system = contextValue.systems.find((system) => system.id === parent.id);
|
const system = contextValue.systems.find((system) => system.id === parent.id);
|
||||||
if (!system) {
|
if (!system) {
|
||||||
@@ -35,9 +35,10 @@ export const SystemResolvers: Resolvers<ServerContext> = {
|
|||||||
id: stop.id,
|
id: stop.id,
|
||||||
name: stop.name,
|
name: stop.name,
|
||||||
coordinates: stop.coordinates as Coordinates,
|
coordinates: stop.coordinates as Coordinates,
|
||||||
|
systemId: parent.id,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
route: async (parent, args, contextValue, info) => {
|
route: async (parent, args, contextValue, _info) => {
|
||||||
if (!args.id) return null;
|
if (!args.id) return null;
|
||||||
const system = contextValue.systems.find((system) => system.id === parent.id);
|
const system = contextValue.systems.find((system) => system.id === parent.id);
|
||||||
if (!system) {
|
if (!system) {
|
||||||
@@ -53,9 +54,10 @@ export const SystemResolvers: Resolvers<ServerContext> = {
|
|||||||
id: route.id,
|
id: route.id,
|
||||||
name: route.name,
|
name: route.name,
|
||||||
polylineCoordinates: route.polylineCoordinates as Coordinates[],
|
polylineCoordinates: route.polylineCoordinates as Coordinates[],
|
||||||
|
systemId: parent.id,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
shuttle: async (parent, args, contextValue, info) => {
|
shuttle: async (parent, args, contextValue, _info) => {
|
||||||
if (!args.id) return null;
|
if (!args.id) return null;
|
||||||
const system = contextValue.systems.find((system) => system.id === parent.id);
|
const system = contextValue.systems.find((system) => system.id === parent.id);
|
||||||
if (!system) {
|
if (!system) {
|
||||||
@@ -68,7 +70,7 @@ export const SystemResolvers: Resolvers<ServerContext> = {
|
|||||||
|
|
||||||
return shuttle;
|
return shuttle;
|
||||||
},
|
},
|
||||||
shuttles: async (parent, args, contextValue, info) => {
|
shuttles: async (parent, args, contextValue, _info) => {
|
||||||
const system = contextValue.systems.find((system) => system.id === parent.id);
|
const system = contextValue.systems.find((system) => system.id === parent.id);
|
||||||
if (!system) {
|
if (!system) {
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
Reference in New Issue
Block a user