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 <yidhra@tuta.io>
This commit is contained in:
parent
6ccc899320
commit
438ae4b5d0
@ -42,7 +42,7 @@ async function createModel(req: Request, res: Response): Promise<Response> {
|
|||||||
|
|
||||||
async function updateModel(req: Request, res: Response): Promise<Response> {
|
async function updateModel(req: Request, res: Response): Promise<Response> {
|
||||||
const body: IDbModel = req.body;
|
const body: IDbModel = req.body;
|
||||||
const doesExist = await ModelService.getBySlug(`${body.slug_name}`);
|
const doesExist = await ModelService.getBySlug(`${req.params["modelSlug"]}`);
|
||||||
if (!doesExist) {
|
if (!doesExist) {
|
||||||
logger.error("Model does not exist");
|
logger.error("Model does not exist");
|
||||||
return res.status(404).json({
|
return res.status(404).json({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user