diff --git a/src/controllers/admin/mentee.controller.ts b/src/controllers/admin/mentee.controller.ts index d73df916..f00aab46 100644 --- a/src/controllers/admin/mentee.controller.ts +++ b/src/controllers/admin/mentee.controller.ts @@ -1,14 +1,14 @@ import type { Request, Response } from 'express' -import { ApplicationStatus, ProfileTypes, StatusUpdatedBy } from '../../enums' -import type Profile from '../../entities/profile.entity' import type Mentee from '../../entities/mentee.entity' -import type { ApiResponse } from '../../types' +import type Profile from '../../entities/profile.entity' +import { ApplicationStatus, ProfileTypes, StatusUpdatedBy } from '../../enums' import { getAllMenteeEmailsService, getAllMentees, getMentee, updateStatus } from '../../services/admin/mentee.service' +import type { ApiResponse } from '../../types' export const getMentees = async ( req: Request, @@ -24,7 +24,7 @@ export const getMentees = async ( return res.status(403).json({ message: 'Only Admins are allowed' }) } - if (status && !(status.toUpperCase() in ApplicationStatus)) { + if (status && !Object.values(ApplicationStatus).includes(status)) { return res.status(400).json({ message: 'Please provide a valid status' }) } diff --git a/src/routes/admin/mentee/mentee.route.ts b/src/routes/admin/mentee/mentee.route.ts index e06e9054..864846d9 100644 --- a/src/routes/admin/mentee/mentee.route.ts +++ b/src/routes/admin/mentee/mentee.route.ts @@ -9,8 +9,8 @@ import { const menteeRouter = express.Router() -menteeRouter.get('/emails/', requireAuth, getAllMenteeEmails) -menteeRouter.get('/applications', requireAuth, getMentees) +menteeRouter.get('/', requireAuth, getMentees) +menteeRouter.get('/emails', requireAuth, getAllMenteeEmails) menteeRouter.get('/:menteeId', requireAuth, getMenteeDetails) menteeRouter.put('/:menteeId/state', requireAuth, updateMenteeStatus)