Skip to content

Commit 7a1fac9

Browse files
authored
Merge pull request #127 from uwblueprint/annie/code-cleanup-and-organization
Annie/code cleanup and organization
2 parents 8959188 + 65a6982 commit 7a1fac9

File tree

176 files changed

+6289
-12430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+6289
-12430
lines changed

.github/workflows/firebase-hosting-merge.yml

-33
This file was deleted.

.github/workflows/firebase-hosting-pull-request.yml

-31
This file was deleted.

.github/workflows/heroku-deploy-dev-ts.yml

-69
This file was deleted.

backend/.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module.exports = {
1818
rules: {
1919
"prettier/prettier": ["error", { endOfLine: "auto" }],
2020
"class-methods-use-this": 0,
21+
"import/prefer-default-export": "off",
2122
},
2223
ignorePatterns: ["build/*"],
2324
};

backend/Procfile

-1
This file was deleted.

backend/graphql/index.ts

+50-95
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,66 @@
1-
import { makeExecutableSchema, gql } from "apollo-server-express";
2-
import { applyMiddleware } from "graphql-middleware";
1+
import { makeExecutableSchema } from "apollo-server-express";
32
import { merge } from "lodash";
3+
// import { applyMiddleware } from "graphql-middleware";
4+
45
import {
56
typeDefs as scalarTypeDefs,
67
resolvers as scalarResolvers,
78
} from "graphql-scalars";
89

9-
// import { UserType } from "../prisma";
10-
// import {
11-
// isAuthorizedByEmail,
12-
// isAuthorizedByUserType,
13-
// isAuthorizedByUserId,
14-
// } from "../middlewares/auth";
15-
import authResolvers from "./resolvers/authResolvers";
16-
import authType from "./types/authType";
17-
import notificationResolvers from "./resolvers/notificationResolvers";
18-
import notificationType from "./types/notificationType";
19-
import staffResolvers from "./resolvers/staffResolver";
20-
import staffType from "./types/staffType";
21-
import residentResolvers from "./resolvers/residentResolvers";
22-
import residentType from "./types/residentType";
23-
import taskResolvers from "./resolvers/taskResolvers";
24-
import taskType from "./types/taskType";
25-
import warningResolvers from "./resolvers/warningResolvers";
26-
import warningType from "./types/warningType";
27-
28-
const query = gql`
29-
type Query {
30-
_empty: String
31-
}
32-
`;
10+
import dataModels from "./types/models";
11+
import customTypes from "./types/enums";
12+
import resolverTypes from "./types/resolvers";
3313

34-
const mutation = gql`
35-
type Mutation {
36-
_empty: String
37-
}
38-
`;
14+
import participantResolvers from "./resolvers/participantResolver";
15+
import miscResolvers from "./resolvers/miscResolver";
3916

40-
const executableSchema = makeExecutableSchema({
41-
typeDefs: [
42-
...scalarTypeDefs,
43-
query,
44-
mutation,
45-
authType,
46-
notificationType,
47-
staffType,
48-
residentType,
49-
taskType,
50-
warningType,
51-
],
52-
resolvers: merge(
53-
scalarResolvers,
54-
authResolvers,
55-
notificationResolvers,
56-
staffResolvers,
57-
residentResolvers,
58-
taskResolvers,
59-
warningResolvers,
60-
),
17+
const schema = makeExecutableSchema({
18+
typeDefs: [...scalarTypeDefs, dataModels, customTypes, resolverTypes],
19+
resolvers: merge(scalarResolvers, participantResolvers, miscResolvers),
6120
});
6221

22+
export default schema;
23+
6324
// const authorizedByAllUserTypes = () =>
6425
// isAuthorizedByUserType(new Set([UserType.STAFF, UserType.RESIDENT]));
6526
// const authorizedByStaff = () =>
6627
// isAuthorizedByUserType(new Set([UserType.STAFF]));
6728

68-
const graphQLMiddlewares = {
69-
Query: {
70-
// getNotificationsByUserId: authorizedByAllUserTypes(),
71-
// getNotificationById: authorizedByAllUserTypes(),
72-
// getStaffByIds: authorizedByStaff(),
73-
// getAllStaff: authorizedByStaff(),
74-
// getResidentsByIds: authorizedByStaff(),
75-
// getAllResidents: authorizedByStaff(),
76-
// getActiveResidents: authorizedByStaff(),
77-
// getTaskById: authorizedByAllUserTypes(),
78-
// getTasksByType: authorizedByAllUserTypes(),
79-
// getTasksByAssigneeId: authorizedByAllUserTypes(),
80-
// getTasksByAssignerId: authorizedByStaff(),
81-
// getTasksByStartDate: authorizedByAllUserTypes(),
82-
// getTasksByEndDate: authorizedByAllUserTypes(),
83-
// getTasksByStatus: authorizedByAllUserTypes(),
84-
},
85-
Mutation: {
86-
// login: isAuthorizedByEmail("email"),
87-
// refresh: isAuthorizedByEmail("email"),
88-
// logout: isAuthorizedByUserId("userId"),
89-
// resetPassword: isAuthorizedByEmail("email"),
90-
// sendNotification: authorizedByAllUserTypes(),
91-
// deleteUserNotification: authorizedByStaff(),
92-
// updateSeenNotification: authorizedByAllUserTypes(),
93-
// sendAnnouncement: authorizedByStaff(),
94-
// addStaff: authorizedByStaff(),
95-
// updateStaff: authorizedByStaff(),
96-
// deleteStaff: authorizedByStaff(),
97-
// addResident: authorizedByStaff(),
98-
// updateResident: authorizedByStaff(),
99-
// deleteResident: authorizedByStaff(),
100-
// redeemCredits: authorizedByStaff(),
101-
// createTask: authorizedByAllUserTypes(),
102-
// updateTask: authorizedByAllUserTypes(),
103-
// deleteTask: authorizedByAllUserTypes(),
104-
// assignTask: authorizedByStaff(),
105-
// changeTaskStatus: authorizedByStaff(),
106-
// addWarning: authorizedByStaff(),
107-
// deleteWarning: authorizedByStaff(),
108-
},
109-
};
29+
// const graphQLMiddlewares = {
30+
// Query: {
31+
// // getNotificationsByUserId: authorizedByAllUserTypes(),
32+
// // getNotificationById: authorizedByAllUserTypes(),
33+
// // getStaffByIds: authorizedByStaff(),
34+
// // getAllStaff: authorizedByStaff(),
35+
// // getResidentsByIds: authorizedByStaff(),
36+
// // getAllResidents: authorizedByStaff(),
37+
// // getActiveResidents: authorizedByStaff(),
38+
// // getTaskById: authorizedByAllUserTypes(),
39+
// // getTasksByType: authorizedByAllUserTypes(),
40+
// // getTasksByAssigneeId: authorizedByAllUserTypes(),
41+
// // getTasksByAssignerId: authorizedByStaff(),
42+
// // getTasksByStartDate: authorizedByAllUserTypes(),
43+
// // getTasksByEndDate: authorizedByAllUserTypes(),
44+
// // getTasksByStatus: authorizedByAllUserTypes(),
45+
// },
46+
// Mutation: {
47+
// // sendNotification: authorizedByAllUserTypes(),
48+
// // deleteUserNotification: authorizedByStaff(),
49+
// // updateSeenNotification: authorizedByAllUserTypes(),
50+
// // sendAnnouncement: authorizedByStaff(),
51+
// // addStaff: authorizedByStaff(),
52+
// // updateStaff: authorizedByStaff(),
53+
// // deleteStaff: authorizedByStaff(),
54+
// // addResident: authorizedByStaff(),
55+
// // updateResident: authorizedByStaff(),
56+
// // deleteResident: authorizedByStaff(),
57+
// // redeemCredits: authorizedByStaff(),
58+
// // createTask: authorizedByAllUserTypes(),
59+
// // updateTask: authorizedByAllUserTypes(),
60+
// // deleteTask: authorizedByAllUserTypes(),
61+
// // assignTask: authorizedByStaff(),
62+
// // changeTaskStatus: authorizedByStaff(),
63+
// },
64+
// };
11065

111-
export default applyMiddleware(executableSchema, graphQLMiddlewares);
66+
// export default applyMiddleware(executableSchema, graphQLMiddlewares);

0 commit comments

Comments
 (0)