Skip to content

Commit 4006133

Browse files
committed
Merge branch 'main' of https://github.com/uwblueprint/website-bp-be into INTF25-applicant-record-review-query
2 parents a00b1cb + 74d97b5 commit 4006133

File tree

13 files changed

+196
-898
lines changed

13 files changed

+196
-898
lines changed

backend/typescript/graphql/index.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ import simpleEntityResolvers from "./resolvers/simpleEntityResolvers";
1515
import simpleEntityType from "./types/simpleEntityType";
1616
import userResolvers from "./resolvers/userResolvers";
1717
import userType from "./types/userType";
18-
import dashboardType from "./types/dashboardType";
19-
import dashboardResolvers from "./resolvers/dashboardResolvers";
20-
import reviewType from "./types/reviewType";
2118
import reviewDashboardResolvers from "./resolvers/reviewDashboardResolvers";
2219
import reviewDashboardType from "./types/reviewDashboardType";
2320

@@ -38,19 +35,16 @@ const executableSchema = makeExecutableSchema({
3835
query,
3936
mutation,
4037
authType,
41-
reviewType,
4238
entityType,
4339
simpleEntityType,
4440
userType,
45-
dashboardType,
4641
reviewDashboardType,
4742
],
4843
resolvers: merge(
4944
authResolvers,
5045
entityResolvers,
5146
simpleEntityResolvers,
5247
userResolvers,
53-
dashboardResolvers,
5448
reviewDashboardResolvers,
5549
),
5650
});
@@ -65,12 +59,6 @@ const graphQLMiddlewares = {
6559
entities: authorizedByAllRoles(),
6660
simpleEntity: authorizedByAllRoles(),
6761
simpleEntities: authorizedByAllRoles(),
68-
dashboardById: authorizedByAllRoles(),
69-
applicationsByRole: authorizedByAllRoles(),
70-
applicationsBySecondChoiceRole: authorizedByAllRoles(),
71-
applicationsById: authorizedByAllRoles(),
72-
applicationTable: authorizedByAllRoles(),
73-
secondChoiceRoleApplicationTable: authorizedByAllRoles(),
7462
userById: authorizedByAdmin(),
7563
userByEmail: authorizedByAdmin(),
7664
login: authorizedByAdmin(),
@@ -83,17 +71,16 @@ const graphQLMiddlewares = {
8371
createSimpleEntity: authorizedByAllRoles(),
8472
updateSimpleEntity: authorizedByAllRoles(),
8573
deleteSimpleEntity: authorizedByAllRoles(),
86-
changeRating: authorizedByAllRoles(),
87-
changeSkillCategory: authorizedByAllRoles(),
88-
updateApplications: authorizedByAllRoles(),
89-
modifyFinalComments: authorizedByAllRoles(),
9074
createUser: authorizedByAdmin(),
9175
updateUser: authorizedByAdmin(),
9276
deleteUserById: authorizedByAdmin(),
9377
deleteUserByEmail: authorizedByAdmin(),
9478
logout: isAuthorizedByUserId("userId"),
9579
resetPassword: isAuthorizedByEmail("email"),
9680
sendSignInLink: authorizedByAllRoles(),
81+
createAdminComment: authorizedByAdmin(),
82+
updateAdminComment: authorizedByAdmin(),
83+
deleteAdminCommentById: authorizedByAdmin(),
9784
},
9885
};
9986

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import AdminCommentService from "../../services/implementations/adminCommentService";
2+
import IAdminCommentService from "../../services/interfaces/adminCommentService";
3+
import { CreateAdminCommentDTO, AdminCommentDTO } from "../../types";
4+
5+
const adminCommentService: IAdminCommentService = new AdminCommentService();
6+
7+
const adminCommentResolvers = {
8+
Mutation: {
9+
createAdminComment: async (
10+
_parent: undefined,
11+
{ adminComment }: { adminComment: CreateAdminCommentDTO },
12+
): Promise<AdminCommentDTO> => {
13+
const newAdminComment = await adminCommentService.createAdminComment(
14+
adminComment,
15+
);
16+
return newAdminComment;
17+
},
18+
updateAdminComment: async (
19+
_parent: undefined,
20+
{ id, content }: { id: string; content: CreateAdminCommentDTO },
21+
): Promise<AdminCommentDTO> => {
22+
const adminComment = await adminCommentService.updateAdminComment(
23+
id,
24+
content,
25+
);
26+
return adminComment;
27+
},
28+
deleteAdminCommentById: async (
29+
_parent: undefined,
30+
{ id }: { id: string },
31+
): Promise<AdminCommentDTO> => {
32+
const adminComment = await adminCommentService.deleteAdminCommentById(id);
33+
return adminComment;
34+
},
35+
},
36+
};
37+
38+
export default adminCommentResolvers;

backend/typescript/graphql/resolvers/authResolvers.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,13 @@ import FirebaseRestClient from "../../utilities/firebaseRestClient";
1010
import IUserService from "../../services/interfaces/userService";
1111
import User from "../../models/user.model";
1212
import { AuthDTO, RegisterUserDTO, Role } from "../../types";
13-
import IReviewService from "../../services/interfaces/reviewService";
14-
import ReviewService from "../../services/implementations/reviewService";
1513

1614
const userService: IUserService = new UserService();
1715
const emailService: IEmailService = new EmailService(
1816
nodemailerConfig,
1917
"UW Blueprint Internal Tools Team",
2018
);
2119
const authService: IAuthService = new AuthService(userService, emailService);
22-
const reviewService: IReviewService = new ReviewService();
2320

2421
// const cookieOptions: CookieOptions = {
2522
// httpOnly: true,
@@ -56,15 +53,6 @@ const authResolvers = {
5653
);
5754
return isAuthorized;
5855
},
59-
isAuthorizedToReview: async (
60-
_parent: undefined,
61-
{
62-
applicationId,
63-
reviewerUserId,
64-
}: { applicationId: number; reviewerUserId: string },
65-
): Promise<boolean> => {
66-
return reviewService.isAuthorizedToReview(applicationId, reviewerUserId);
67-
},
6856
},
6957
Mutation: {
7058
login: async (

backend/typescript/graphql/resolvers/dashboardResolvers.ts

Lines changed: 0 additions & 163 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { gql } from "apollo-server-express";
2+
3+
const adminCommentsType = gql`
4+
type AdminCommentDTO {
5+
id: String!
6+
userId: Int!
7+
applicantRecordId: String!
8+
comment: String!
9+
createdAt: String!
10+
updatedAt: String!
11+
}
12+
13+
input CreateAdminCommentDTO {
14+
userId: Int!
15+
applicantRecordId: String!
16+
comment: String!
17+
}
18+
19+
extend type Mutation {
20+
createAdminComment(adminComment: CreateAdminCommentDTO!): AdminCommentDTO!
21+
updateAdminComment(
22+
id: String!
23+
content: CreateAdminCommentDTO!
24+
): AdminCommentDTO!
25+
deleteAdminCommentById(id: String!): AdminCommentDTO!
26+
}
27+
`;
28+
29+
export default adminCommentsType;

0 commit comments

Comments
 (0)