Skip to content

Commit 6371482

Browse files
committed
add updateApplicantStatus and bulkUpdateApplicantStatus to GraphQL resolver and type files
1 parent 65520d7 commit 6371482

File tree

3 files changed

+49
-3
lines changed

3 files changed

+49
-3
lines changed

backend/typescript/graphql/resolvers/applicantRecordResolvers.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,40 @@
11
import ApplicantRecordService from "../../services/implementations/applicantRecordService";
22
import IApplicantRecordService from "../../services/interfaces/applicantRecordService";
3-
import { ApplicantRecordDTO } from "../../types";
3+
import { ApplicantRecordDTO, ApplicationStatus } from "../../types";
44

55
const applicantRecordService: IApplicantRecordService =
66
new ApplicantRecordService();
77

88
const applicantRecordResolvers = {
99
Mutation: {
10+
updateApplicantStatus: async (
11+
_parent: undefined,
12+
{
13+
applicantRecordId,
14+
status,
15+
}: { applicantRecordId: string; status: ApplicationStatus },
16+
): Promise<ApplicantRecordDTO> => {
17+
const applicantRecord =
18+
await applicantRecordService.updateApplicantStatus(
19+
applicantRecordId,
20+
status,
21+
);
22+
return applicantRecord;
23+
},
24+
bulkUpdateApplicantStatus: async (
25+
_parent: undefined,
26+
{
27+
applicantRecordIds,
28+
status,
29+
}: { applicantRecordIds: string[]; status: ApplicationStatus },
30+
): Promise<ApplicantRecordDTO[]> => {
31+
const applicantRecords =
32+
await applicantRecordService.bulkUpdateApplicantStatus(
33+
applicantRecordIds,
34+
status,
35+
);
36+
return applicantRecords;
37+
},
1038
setApplicantRecordFlag: async (
1139
_parent: undefined,
1240
{

backend/typescript/graphql/types/applicantRecordType.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,37 @@
11
import { gql } from "apollo-server-express";
22

33
const applicantRecordType = gql`
4+
enum ApplicationStatus {
5+
Applied
6+
InReview
7+
Reviewed
8+
Selected
9+
Interviewed
10+
Offer
11+
Rejected
12+
}
13+
414
type ApplicantRecordDTO {
515
id: String!
616
applicantId: String!
717
position: String!
818
roleSpecificQuestions: [String!]!
919
choice: Int!
10-
status: String!
20+
status: ApplicationStatus!
1121
skillCategory: String
1222
combined_score: Int
1323
isApplicantFlagged: Boolean!
1424
}
1525
1626
extend type Mutation {
27+
updateApplicantStatus(
28+
applicantRecordId: String!
29+
status: ApplicationStatus!
30+
): ApplicantRecordDTO!
31+
bulkUpdateApplicantStatus(
32+
applicantRecordIds: [String!]!
33+
status: ApplicationStatus!
34+
): [ApplicantRecordDTO!]!
1735
setApplicantRecordFlag(
1836
applicantRecordId: String!
1937
flagValue: Boolean!

backend/typescript/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export type ApplicantRecordDTO = {
9191

9292
export type ApplicationStatus =
9393
| "Applied"
94-
| "In Review"
94+
| "InReview"
9595
| "Reviewed"
9696
| "Selected"
9797
| "Interviewed"

0 commit comments

Comments
 (0)