Skip to content

Commit 7bd51ca

Browse files
committed
Merge branch 'main' into INTF25-review-status-mutator
2 parents 9350851 + daecb44 commit 7bd51ca

22 files changed

+785
-21
lines changed

backend/typescript/graphql/index.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ import userResolvers from "./resolvers/userResolvers";
1717
import userType from "./types/userType";
1818
import reviewDashboardResolvers from "./resolvers/reviewDashboardResolvers";
1919
import reviewDashboardType from "./types/reviewDashboardType";
20+
import reviewedApplicantRecordResolvers from "./resolvers/reviewedApplicantRecordResolvers";
21+
import reviewedApplicantRecordTypes from "./types/reviewedApplicantRecordTypes";
2022
import adminCommentResolvers from "./resolvers/adminCommentsResolvers";
2123
import adminCommentType from "./types/adminCommentsType";
24+
import applicantRecordResolvers from "./resolvers/applicantRecordResolvers";
25+
import applicantRecordType from "./types/applicantRecordType";
2226
import reviewPageType from "./types/reviewPageType";
2327
import reviewPageResolvers from "./resolvers/reviewPageResolvers";
24-
import reviewedApplicantRecordType from "./types/reviewedApplicantRecordType";
25-
import reviewedApplicantRecordResolvers from "./resolvers/reviewedApplicantRecordResolvers";
2628

2729
const query = gql`
2830
type Query {
@@ -45,19 +47,21 @@ const executableSchema = makeExecutableSchema({
4547
simpleEntityType,
4648
userType,
4749
reviewDashboardType,
50+
reviewedApplicantRecordTypes,
4851
adminCommentType,
52+
applicantRecordType,
4953
reviewPageType,
50-
reviewedApplicantRecordType,
5154
],
5255
resolvers: merge(
5356
authResolvers,
5457
entityResolvers,
5558
simpleEntityResolvers,
5659
userResolvers,
5760
reviewDashboardResolvers,
61+
reviewedApplicantRecordResolvers,
5862
adminCommentResolvers,
63+
applicantRecordResolvers,
5964
reviewPageResolvers,
60-
reviewedApplicantRecordResolvers,
6165
),
6266
});
6367

@@ -75,6 +79,8 @@ const graphQLMiddlewares = {
7579
userByEmail: authorizedByAdmin(),
7680
login: authorizedByAdmin(),
7781
users: authorizedByAdmin(),
82+
adminCommentsByApplicantRecordId: authorizedByAdmin(),
83+
adminCommentById: authorizedByAdmin(),
7884
},
7985
Mutation: {
8086
createEntity: authorizedByAllRoles(),
@@ -83,6 +89,10 @@ const graphQLMiddlewares = {
8389
createSimpleEntity: authorizedByAllRoles(),
8490
updateSimpleEntity: authorizedByAllRoles(),
8591
deleteSimpleEntity: authorizedByAllRoles(),
92+
createReviewedApplicantRecord: authorizedByAllRoles(),
93+
bulkCreateReviewedApplicantRecord: authorizedByAllRoles(),
94+
deleteReviewedApplicantRecord: authorizedByAllRoles(),
95+
bulkDeleteReviewedApplicantRecord: authorizedByAllRoles(),
8696
createUser: authorizedByAdmin(),
8797
updateUser: authorizedByAdmin(),
8898
deleteUserById: authorizedByAdmin(),
@@ -93,6 +103,7 @@ const graphQLMiddlewares = {
93103
createAdminComment: authorizedByAdmin(),
94104
updateAdminComment: authorizedByAdmin(),
95105
deleteAdminCommentById: authorizedByAdmin(),
106+
updateReviewStatus: authorizedByAllRoles(),
96107
},
97108
};
98109

backend/typescript/graphql/resolvers/adminCommentsResolvers.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ import { CreateAdminCommentDTO, AdminCommentDTO } from "../../types";
55
const adminCommentService: IAdminCommentService = new AdminCommentService();
66

77
const adminCommentResolvers = {
8+
Query: {
9+
adminCommentsByApplicantRecordId: async (
10+
_parent: undefined,
11+
{ applicantRecordId }: { applicantRecordId: string },
12+
): Promise<AdminCommentDTO[]> => {
13+
const adminComments =
14+
await adminCommentService.getAdminCommentsByApplicantRecordId(
15+
applicantRecordId,
16+
);
17+
return adminComments;
18+
},
19+
adminCommentById: async (
20+
_parent: undefined,
21+
{ id }: { id: string },
22+
): Promise<AdminCommentDTO> => {
23+
const adminComment = await adminCommentService.getAdminCommentById(id);
24+
return adminComment;
25+
},
26+
},
827
Mutation: {
928
createAdminComment: async (
1029
_parent: undefined,
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import ApplicantRecordService from "../../services/implementations/applicantRecordService";
2+
import IApplicantRecordService from "../../services/interfaces/applicantRecordService";
3+
import { ApplicantRecordDTO } from "../../types";
4+
import { getErrorMessage } from "../../utilities/errorUtils";
5+
6+
const applicantRecordService: IApplicantRecordService =
7+
new ApplicantRecordService();
8+
9+
const applicantRecordResolvers = {
10+
Mutation: {
11+
setApplicantRecordFlag: async (
12+
_parent: undefined,
13+
{
14+
applicantRecordId,
15+
flagValue,
16+
}: { applicantRecordId: string; flagValue: boolean },
17+
): Promise<ApplicantRecordDTO> => {
18+
try {
19+
const applicantRecord =
20+
await applicantRecordService.setApplicantRecordFlag(
21+
applicantRecordId,
22+
flagValue,
23+
);
24+
return applicantRecord;
25+
} catch (error: unknown) {
26+
throw new Error(getErrorMessage(error));
27+
}
28+
},
29+
},
30+
};
31+
32+
export default applicantRecordResolvers;
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import ReviewedApplicantRecordService from "../../services/implementations/reviewedApplicantRecordService";
2+
import {
3+
ReviewedApplicantRecordDTO,
4+
CreateReviewedApplicantRecordDTO,
5+
DeleteReviewedApplicantRecordDTO,
6+
} from "../../types";
7+
import { getErrorMessage } from "../../utilities/errorUtils";
8+
9+
const reviewedApplicantRecordService = new ReviewedApplicantRecordService();
10+
11+
const reviewedApplicantRecordResolvers = {
12+
Mutation: {
13+
createReviewedApplicantRecord: async (
14+
_parent: undefined,
15+
args: { input: CreateReviewedApplicantRecordDTO },
16+
): Promise<ReviewedApplicantRecordDTO> => {
17+
try {
18+
return await reviewedApplicantRecordService.createReviewedApplicantRecord(
19+
args.input,
20+
);
21+
} catch (error) {
22+
throw new Error(getErrorMessage(error));
23+
}
24+
},
25+
26+
bulkCreateReviewedApplicantRecord: async (
27+
_parent: undefined,
28+
args: { inputs: CreateReviewedApplicantRecordDTO[] },
29+
): Promise<ReviewedApplicantRecordDTO[]> => {
30+
try {
31+
return await reviewedApplicantRecordService.bulkCreateReviewedApplicantRecord(
32+
args.inputs,
33+
);
34+
} catch (error) {
35+
throw new Error(getErrorMessage(error));
36+
}
37+
},
38+
39+
deleteReviewedApplicantRecord: async (
40+
_parent: undefined,
41+
args: { input: DeleteReviewedApplicantRecordDTO },
42+
): Promise<ReviewedApplicantRecordDTO> => {
43+
try {
44+
return await reviewedApplicantRecordService.deleteReviewedApplicantRecord(
45+
args.input,
46+
);
47+
} catch (error) {
48+
throw new Error(getErrorMessage(error));
49+
}
50+
},
51+
52+
bulkDeleteReviewedApplicantRecord: async (
53+
_parent: undefined,
54+
args: { inputs: DeleteReviewedApplicantRecordDTO[] },
55+
): Promise<ReviewedApplicantRecordDTO[]> => {
56+
try {
57+
return await reviewedApplicantRecordService.bulkDeleteReviewedApplicantRecord(
58+
args.inputs,
59+
);
60+
} catch (error) {
61+
throw new Error(getErrorMessage(error));
62+
}
63+
},
64+
65+
updateReviewStatus: async (
66+
_parent: undefined,
67+
args: { applicantRecordId: string; reviewerId: number; status: string },
68+
): Promise<ReviewedApplicantRecordDTO> => {
69+
try {
70+
return await reviewedApplicantRecordService.updateReviewStatus(
71+
args.applicantRecordId,
72+
args.reviewerId,
73+
args.status,
74+
);
75+
} catch (error) {
76+
throw new Error(getErrorMessage(error));
77+
}
78+
},
79+
},
80+
};
81+
82+
export default reviewedApplicantRecordResolvers;

backend/typescript/graphql/types/adminCommentsType.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ const adminCommentsType = gql`
1616
comment: String!
1717
}
1818
19+
extend type Query {
20+
adminCommentsByApplicantRecordId(
21+
applicantRecordId: String!
22+
): [AdminCommentDTO!]!
23+
adminCommentById(id: String!): AdminCommentDTO!
24+
}
25+
1926
extend type Mutation {
2027
createAdminComment(adminComment: CreateAdminCommentDTO!): AdminCommentDTO!
2128
updateAdminComment(
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { gql } from "apollo-server-express";
2+
3+
const applicantRecordType = gql`
4+
type ApplicantRecordDTO {
5+
id: String!
6+
applicantId: String!
7+
position: String!
8+
roleSpecificQuestions: [String!]!
9+
choice: Int!
10+
status: String!
11+
skillCategory: String
12+
combined_score: Int
13+
isApplicantFlagged: Boolean!
14+
}
15+
16+
extend type Mutation {
17+
setApplicantRecordFlag(
18+
applicantRecordId: String!
19+
flagValue: Boolean!
20+
): ApplicantRecordDTO!
21+
}
22+
`;
23+
24+
export default applicantRecordType;

backend/typescript/graphql/types/reviewDashboardType.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { gql } from "apollo-server-express";
2-
import { ApplicationStatus, PositionTitle, ReviewerDTO } from "../../types";
32

43
const reviewDashboardType = gql`
54
type ReviewerDTO {
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import { gql } from "apollo-server-express";
2+
3+
const reviewedApplicantRecordTypes = gql`
4+
enum SkillCategory {
5+
JUNIOR
6+
INTERMEDIATE
7+
SENIOR
8+
}
9+
10+
enum ReviewStatus {
11+
NeedsReview
12+
InProgress
13+
Done
14+
ConflictReported
15+
}
16+
17+
type Review {
18+
passionFSG: Int
19+
teamPlayer: Int
20+
desireToLearn: Int
21+
skill: Int
22+
skillCategory: SkillCategory
23+
}
24+
25+
input ReviewInput {
26+
passionFSG: Int
27+
teamPlayer: Int
28+
desireToLearn: Int
29+
skill: Int
30+
skillCategory: SkillCategory
31+
}
32+
33+
type ReviewedApplicantRecord {
34+
applicantRecordId: ID!
35+
reviewerId: Int!
36+
review: Review
37+
status: ReviewStatus
38+
score: Int
39+
reviewerHasConflict: Boolean
40+
}
41+
42+
input CreateReviewedApplicantRecordInput {
43+
applicantRecordId: ID!
44+
reviewerId: Int!
45+
review: ReviewInput
46+
status: ReviewStatus
47+
}
48+
49+
input DeleteReviewedApplicantRecord {
50+
applicantRecordId: ID!
51+
reviewerId: Int!
52+
}
53+
54+
extend type Mutation {
55+
createReviewedApplicantRecord(
56+
input: CreateReviewedApplicantRecordInput!
57+
): ReviewedApplicantRecord!
58+
59+
bulkCreateReviewedApplicantRecord(
60+
inputs: [CreateReviewedApplicantRecordInput!]!
61+
): [ReviewedApplicantRecord!]!
62+
63+
deleteReviewedApplicantRecord(
64+
input: DeleteReviewedApplicantRecord!
65+
): ReviewedApplicantRecord!
66+
67+
bulkDeleteReviewedApplicantRecord(
68+
inputs: [DeleteReviewedApplicantRecord!]!
69+
): [ReviewedApplicantRecord!]!
70+
71+
updateReviewStatus(
72+
applicantRecordId: ID!
73+
reviewerId: Int!
74+
status: ReviewStatus!
75+
): ReviewedApplicantRecord!
76+
}
77+
`;
78+
79+
export default reviewedApplicantRecordTypes;

0 commit comments

Comments
 (0)