11import { makeExecutableSchema , gql } from "apollo-server-express" ;
2- import { applyMiddleware } from "graphql-middleware" ;
32import { merge } from "lodash" ;
3+ // import { applyMiddleware } from "graphql-middleware";
4+
45import {
56 typeDefs as scalarTypeDefs ,
67 resolvers as scalarResolvers ,
78} from "graphql-scalars" ;
89
9- import helloResolver from "./resolvers/helloResolver" ;
1010
1111import dataModels from "./types/models" ;
1212import customTypes from "./types/enums" ;
1313import resolverTypes from "./types/resolvers" ;
1414
15- const executableSchema = makeExecutableSchema ( {
15+ import participantResolvers from "./resolvers/participantResolver" ;
16+ import miscResolvers from "./resolvers/miscResolver" ;
17+
18+ const schema = makeExecutableSchema ( {
1619 typeDefs : [
1720 ...scalarTypeDefs ,
1821 dataModels ,
@@ -21,50 +24,53 @@ const executableSchema = makeExecutableSchema({
2124 ] ,
2225 resolvers : merge (
2326 scalarResolvers ,
24- helloResolver
27+ participantResolvers ,
28+ miscResolvers
2529 ) ,
2630} ) ;
2731
32+ export default schema ;
33+
2834// const authorizedByAllUserTypes = () =>
2935// isAuthorizedByUserType(new Set([UserType.STAFF, UserType.RESIDENT]));
3036// const authorizedByStaff = () =>
3137// isAuthorizedByUserType(new Set([UserType.STAFF]));
3238
33- const graphQLMiddlewares = {
34- Query : {
35- // getNotificationsByUserId: authorizedByAllUserTypes(),
36- // getNotificationById: authorizedByAllUserTypes(),
37- // getStaffByIds: authorizedByStaff(),
38- // getAllStaff: authorizedByStaff(),
39- // getResidentsByIds: authorizedByStaff(),
40- // getAllResidents: authorizedByStaff(),
41- // getActiveResidents: authorizedByStaff(),
42- // getTaskById: authorizedByAllUserTypes(),
43- // getTasksByType: authorizedByAllUserTypes(),
44- // getTasksByAssigneeId: authorizedByAllUserTypes(),
45- // getTasksByAssignerId: authorizedByStaff(),
46- // getTasksByStartDate: authorizedByAllUserTypes(),
47- // getTasksByEndDate: authorizedByAllUserTypes(),
48- // getTasksByStatus: authorizedByAllUserTypes(),
49- } ,
50- Mutation : {
51- // sendNotification: authorizedByAllUserTypes(),
52- // deleteUserNotification: authorizedByStaff(),
53- // updateSeenNotification: authorizedByAllUserTypes(),
54- // sendAnnouncement: authorizedByStaff(),
55- // addStaff: authorizedByStaff(),
56- // updateStaff: authorizedByStaff(),
57- // deleteStaff: authorizedByStaff(),
58- // addResident: authorizedByStaff(),
59- // updateResident: authorizedByStaff(),
60- // deleteResident: authorizedByStaff(),
61- // redeemCredits: authorizedByStaff(),
62- // createTask: authorizedByAllUserTypes(),
63- // updateTask: authorizedByAllUserTypes(),
64- // deleteTask: authorizedByAllUserTypes(),
65- // assignTask: authorizedByStaff(),
66- // changeTaskStatus: authorizedByStaff(),
67- } ,
68- } ;
39+ // const graphQLMiddlewares = {
40+ // Query: {
41+ // // getNotificationsByUserId: authorizedByAllUserTypes(),
42+ // // getNotificationById: authorizedByAllUserTypes(),
43+ // // getStaffByIds: authorizedByStaff(),
44+ // // getAllStaff: authorizedByStaff(),
45+ // // getResidentsByIds: authorizedByStaff(),
46+ // // getAllResidents: authorizedByStaff(),
47+ // // getActiveResidents: authorizedByStaff(),
48+ // // getTaskById: authorizedByAllUserTypes(),
49+ // // getTasksByType: authorizedByAllUserTypes(),
50+ // // getTasksByAssigneeId: authorizedByAllUserTypes(),
51+ // // getTasksByAssignerId: authorizedByStaff(),
52+ // // getTasksByStartDate: authorizedByAllUserTypes(),
53+ // // getTasksByEndDate: authorizedByAllUserTypes(),
54+ // // getTasksByStatus: authorizedByAllUserTypes(),
55+ // },
56+ // Mutation: {
57+ // // sendNotification: authorizedByAllUserTypes(),
58+ // // deleteUserNotification: authorizedByStaff(),
59+ // // updateSeenNotification: authorizedByAllUserTypes(),
60+ // // sendAnnouncement: authorizedByStaff(),
61+ // // addStaff: authorizedByStaff(),
62+ // // updateStaff: authorizedByStaff(),
63+ // // deleteStaff: authorizedByStaff(),
64+ // // addResident: authorizedByStaff(),
65+ // // updateResident: authorizedByStaff(),
66+ // // deleteResident: authorizedByStaff(),
67+ // // redeemCredits: authorizedByStaff(),
68+ // // createTask: authorizedByAllUserTypes(),
69+ // // updateTask: authorizedByAllUserTypes(),
70+ // // deleteTask: authorizedByAllUserTypes(),
71+ // // assignTask: authorizedByStaff(),
72+ // // changeTaskStatus: authorizedByStaff(),
73+ // },
74+ // };
6975
70- export default applyMiddleware ( executableSchema , graphQLMiddlewares ) ;
76+ // export default applyMiddleware(executableSchema, graphQLMiddlewares);
0 commit comments