diff --git a/src/middlewares/existance.js b/src/middlewares/existance.js index 73c2c88..a796b98 100644 --- a/src/middlewares/existance.js +++ b/src/middlewares/existance.js @@ -3,7 +3,9 @@ import responseCodes from '../response/responseCodes.js'; import GroupService from '../services/group.js'; const groupExists = async (req, res, next) => { - let groupId = req.params.groupId || req.body.groupId; + let groupId = Number(req.params.groupId || req.body.groupId); + + if (isNaN(groupId)) throw new customError(`groupId is not a number`, responseCodes.responses.groups.id_not_found) let group = await GroupService.getById(groupId);