mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
implement endpoints and update test
This commit is contained in:
@@ -78,11 +78,27 @@ export const SystemResolvers: Resolvers<ServerContext> = {
|
||||
|
||||
return await system.shuttleRepository.getShuttles();
|
||||
},
|
||||
parkingStructures: async (_parent, _args, _contextValue, _info) => {
|
||||
return [];
|
||||
parkingStructures: async (parent, _args, contextValue, _info) => {
|
||||
const system = contextValue.findSystemById(parent.id);
|
||||
if (!system) {
|
||||
return [];
|
||||
}
|
||||
const parkingRepository = system.parkingRepository;
|
||||
if (!parkingRepository) return [];
|
||||
|
||||
return await parkingRepository.getParkingStructures();
|
||||
},
|
||||
parkingStructure: async (_parent, _args, _contextValue, _info) => {
|
||||
return null;
|
||||
parkingStructure: async (parent, args, contextValue, info) => {
|
||||
if (!args.id) return null;
|
||||
|
||||
const system = contextValue.findSystemById(parent.id);
|
||||
if (!system) {
|
||||
return null;
|
||||
}
|
||||
const parkingRepository = system.parkingRepository;
|
||||
if (!parkingRepository) return null;
|
||||
|
||||
return await parkingRepository.getParkingStructureById(args.id);
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user