The commit introduces BrandController methods to the catalog router. Specifically, it implements create, getAll, getBySlug, update, and delete functionalities for brand routes. This update enhances brand management within the catalog. Signed-off-by: Mathis <yidhra@tuta.io>
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
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";
|
|
import BrandController from "@controllers/brand.controller";
|
|
|
|
|
|
const CatalogRouter: Router = express.Router();
|
|
|
|
//-- MODELS >>
|
|
|
|
CatalogRouter.route('/model/new').get(AdminGuard, ModelController.create)
|
|
|
|
CatalogRouter.route('/model/all').get(ModelController.getAll)
|
|
|
|
CatalogRouter.route('/model/:modelSlug')
|
|
.get(UserGuard, ModelController.getBySlug)
|
|
.patch(AdminGuard, ModelController.update)
|
|
.delete(AdminGuard, ModelController.delete)
|
|
|
|
|
|
//-- CATEGORY >>
|
|
|
|
CatalogRouter.route('/category/new').get(AdminGuard, CategoryController.create)
|
|
|
|
CatalogRouter.route('/category/all').get(CategoryController.getAll)
|
|
|
|
CatalogRouter.route('/category/:categorySlug')
|
|
.get(UserGuard, CategoryController.getBySlug)
|
|
.patch(AdminGuard, CategoryController.update)
|
|
.delete(AdminGuard, CategoryController.delete)
|
|
|
|
|
|
//-- BRAND >>
|
|
|
|
CatalogRouter.route('/brand/new').post(AdminGuard, BrandController.create)
|
|
CatalogRouter.route('/brand/all').get(BrandController.getAll)
|
|
CatalogRouter.route('/brand/:brandSlug')
|
|
.get(UserGuard, BrandController.getBySlug)
|
|
.patch(AdminGuard, BrandController.update)
|
|
.delete(AdminGuard, BrandController.delete)
|
|
|
|
export default CatalogRouter; |