check for system association in system resolvers

This commit is contained in:
2025-01-29 00:03:31 -08:00
parent fd4a92e34b
commit f1579904c7

View File

@@ -14,6 +14,8 @@ export const SystemResolvers: Resolvers<ServerContext> = {
const stop = await contextValue.repository.getStopById(args.id); const stop = await contextValue.repository.getStopById(args.id);
if (stop === null) return null; if (stop === null) return null;
if (stop.systemId !== parent.id) return null;
return { return {
id: stop.id, id: stop.id,
name: stop.name, name: stop.name,
@@ -25,6 +27,8 @@ export const SystemResolvers: Resolvers<ServerContext> = {
const route = await contextValue.repository.getRouteById(args.id); const route = await contextValue.repository.getRouteById(args.id);
if (route === null) return null; if (route === null) return null;
if (route.systemId !== parent.id) return null;
return { return {
color: route.color, color: route.color,
id: route.id, id: route.id,
@@ -37,6 +41,8 @@ export const SystemResolvers: Resolvers<ServerContext> = {
const shuttle = await contextValue.repository.getShuttleById(args.id); const shuttle = await contextValue.repository.getShuttleById(args.id);
if (shuttle === null) return null; if (shuttle === null) return null;
if (shuttle.systemId !== parent.id) return null;
return shuttle; return shuttle;
}, },
shuttles: async (parent, args, contextValue, info) => { shuttles: async (parent, args, contextValue, info) => {