split query resolvers into separate files

This commit is contained in:
2025-01-23 03:33:43 -08:00
parent 36d1a24484
commit d506f9bbfe
3 changed files with 25 additions and 25 deletions

View File

@@ -0,0 +1,20 @@
import { ServerContext } from "../ServerContext";
import { Resolvers } from "../generated/graphql";
export const QueryResolvers: Resolvers<ServerContext> = {
Query: {
systems: async (parent, args, contextValue, info) => {
return await contextValue.repository.getSystems();
},
system: async (parent, args, contextValue, info) => {
if (!args.id) return null;
const system = await contextValue.repository.getSystemById(args.id);
if (system === null) return null;
return {
name: system.name,
id: system.id,
};
}
},
}