added tesf for NaN in existance.groupExists

This commit is contained in:
leca 2024-11-04 04:30:29 +03:00
parent 69c2255614
commit 693a0980d9
1 changed files with 3 additions and 1 deletions

View File

@ -3,7 +3,9 @@ import responseCodes from '../response/responseCodes.js';
import GroupService from '../services/group.js'; import GroupService from '../services/group.js';
const groupExists = async (req, res, next) => { 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); let group = await GroupService.getById(groupId);