From 438ae4b5d0c5216f4a24abbc459eaf191b310d50 Mon Sep 17 00:00:00 2001 From: Mathis Date: Fri, 3 May 2024 13:17:58 +0200 Subject: [PATCH] fix(controllers): update model slug in `updateModel` function The model slug has been updated to use `req.params["modelSlug"]` instead of `body.slug_name` in the `updateModel` function, ensuring the correct slug is used when checking if the model exists. Signed-off-by: Mathis --- src/controllers/model.controller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/model.controller.ts b/src/controllers/model.controller.ts index 1152d4a..464daf7 100644 --- a/src/controllers/model.controller.ts +++ b/src/controllers/model.controller.ts @@ -42,7 +42,7 @@ async function createModel(req: Request, res: Response): Promise { async function updateModel(req: Request, res: Response): Promise { const body: IDbModel = req.body; - const doesExist = await ModelService.getBySlug(`${body.slug_name}`); + const doesExist = await ModelService.getBySlug(`${req.params["modelSlug"]}`); if (!doesExist) { logger.error("Model does not exist"); return res.status(404).json({