Skip to content

Commit 2160f06

Browse files
committed
Add some checks for verdict
1 parent 41f6693 commit 2160f06

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/controllers/interview.controller.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ export const getInterviews = async (req: Request, res: Response) => {
66
const page = parseInt(req.query.page as string) || 1;
77
const limit = parseInt(req.query.limit as string) || 10;
88
const verdict = (req.query.verdict as string) || "All";
9+
const validVerdicts = ["All", "Selected", "Rejected", "Pending"]
910

1011
if(isNaN(page) || page<1){
1112
throw new ApiError("Page must be greater than or equal to 1",400);
1213
}
1314
if(isNaN(limit) || limit<1 || limit>100){
1415
throw new ApiError("Limit must be between 1 to 100",400)
1516
}
17+
if(!validVerdicts.includes(verdict)){
18+
throw new ApiError("Invalid verdict",400);
19+
}
1620

1721
const { interviews, total } = await interviewService.getInterviews(page, limit, verdict);
1822

0 commit comments

Comments
 (0)