added tesf for NaN in existance.groupExists
This commit is contained in:
parent
69c2255614
commit
693a0980d9
|
@ -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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue