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> = {
|
||||
System: {
|
||||
routes: async (parent, args, contextValue, info) => {
|
||||
routes: async (parent, args, contextValue, _info) => {
|
||||
const system = contextValue.systems.find((system) => system.id === parent.id);
|
||||
if (!system) {
|
||||
return [];
|
||||
@@ -11,7 +11,7 @@ export const SystemResolvers: Resolvers<ServerContext> = {
|
||||
|
||||
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);
|
||||
if (!system) {
|
||||
return [];
|
||||
@@ -19,7 +19,7 @@ export const SystemResolvers: Resolvers<ServerContext> = {
|
||||
|
||||
return await system.shuttleRepository.getStopsBySystemId(parent.id);
|
||||
},
|
||||
stop: async (parent, args, contextValue, info) => {
|
||||
stop: async (parent, args, contextValue, _info) => {
|
||||
if (!args.id) return null;
|
||||
const system = contextValue.systems.find((system) => system.id === parent.id);
|
||||
if (!system) {
|
||||
@@ -35,9 +35,10 @@ export const SystemResolvers: Resolvers<ServerContext> = {
|
||||
id: stop.id,
|
||||
name: stop.name,
|
||||
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;
|
||||
const system = contextValue.systems.find((system) => system.id === parent.id);
|
||||
if (!system) {
|
||||
@@ -53,9 +54,10 @@ export const SystemResolvers: Resolvers<ServerContext> = {
|
||||
id: route.id,
|
||||
name: route.name,
|
||||
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;
|
||||
const system = contextValue.systems.find((system) => system.id === parent.id);
|
||||
if (!system) {
|
||||
@@ -68,7 +70,7 @@ export const SystemResolvers: Resolvers<ServerContext> = {
|
||||
|
||||
return shuttle;
|
||||
},
|
||||
shuttles: async (parent, args, contextValue, info) => {
|
||||
shuttles: async (parent, args, contextValue, _info) => {
|
||||
const system = contextValue.systems.find((system) => system.id === parent.id);
|
||||
if (!system) {
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user