feat(routes): update catalog routes with ModelController methods
A ModelController has been imported and its methods applied to the catalogue routes in the system. The changes include methods for creating, getting all, getting by slug, updating, and deleting models. Prior routes have been updated and enhanced with these additional controller methods for improved performance. Issue: #28 Signed-off-by: Mathis <yidhra@tuta.io>
This commit is contained in:
parent
57151ec777
commit
37ec62405e
@ -2,20 +2,21 @@ import express, {type Router} from "express";
|
||||
import AdminGuard from "@validators/AdminGuard";
|
||||
import UserGuard from "@validators/UserGuard";
|
||||
import CategoryController from "@controllers/category.controller";
|
||||
import ModelController from "@controllers/model.controller";
|
||||
|
||||
|
||||
const CatalogRouter: Router = express.Router();
|
||||
|
||||
//-- MODELS >>
|
||||
|
||||
CatalogRouter.route('/model/new').get(AdminGuard)
|
||||
CatalogRouter.route('/model/new').get(AdminGuard, ModelController.create)
|
||||
|
||||
CatalogRouter.route('/model/all').get()
|
||||
CatalogRouter.route('/model/all').get(ModelController.getAll)
|
||||
|
||||
CatalogRouter.route('/model/:modelSlug')
|
||||
.get(UserGuard)
|
||||
.patch(AdminGuard)
|
||||
.delete(AdminGuard)
|
||||
.get(UserGuard, ModelController.getBySlug)
|
||||
.patch(AdminGuard, ModelController.update)
|
||||
.delete(AdminGuard, ModelController.delete)
|
||||
|
||||
|
||||
//-- CATEGORY >>
|
||||
|
Loading…
x
Reference in New Issue
Block a user