From 7d76917591745adce11efa16896b6680b17e64d3 Mon Sep 17 00:00:00 2001 From: Patrick Mueller Date: Tue, 11 Jan 2022 17:26:17 +0100 Subject: [PATCH] Even more debugging the gym_id --- .../climbing_routes/climbingRoutes.router.ts | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/models/climbing-route-rating/climbing_routes/climbingRoutes.router.ts b/src/models/climbing-route-rating/climbing_routes/climbingRoutes.router.ts index 34c8658..3e6f4aa 100644 --- a/src/models/climbing-route-rating/climbing_routes/climbingRoutes.router.ts +++ b/src/models/climbing-route-rating/climbing_routes/climbingRoutes.router.ts @@ -195,29 +195,15 @@ climbingRoutesRouter.get('/:id', async (req: Request, res: Response) => { */ climbingRoutesRouter.post('/', async (req: Request, res: Response) => { try { - let gym_id = parseInt(req.query.gym_id as string, 10); + let gym_id = Number(req.query.gym_id); let name = req.query.name as string; let difficulty = req.query.difficulty as string; let captcha_token = req.query['hcaptcha_response'] as string; if (isNaN(gym_id) || !name || !difficulty || !captcha_token) { - let missing = ''; - if (isNaN(gym_id)) { - missing += 'gym_id;'; - } else if (!name) { - missing += 'name;'; - } else if (!difficulty) { - missing += 'difficulty;'; - } else if (!captcha_token) { - missing += 'token;'; - } else { - missing += 'all good'; - } - res.status(400).send({ 'message': 'Missing parameters', - 'missing': missing, - 'value': req.query.gym_id + 'query_params': req.query.toString() }); return; }