other
This commit is contained in:
24
backend/routes/promotion.routes.js
Normal file
24
backend/routes/promotion.routes.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import express from "express";
|
||||
import {
|
||||
getPromotions,
|
||||
getPromotionById,
|
||||
createPromotion,
|
||||
updatePromotion,
|
||||
deletePromotion,
|
||||
validatePromotion
|
||||
} from "../controllers/promotion.controller.js";
|
||||
import { protectVendor } from "../middleware/vendorAuthMiddleware.js";
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
// Vendor routes for managing their own promotions (protected)
|
||||
router.get("/", protectVendor, getPromotions);
|
||||
router.get("/:id", protectVendor, getPromotionById);
|
||||
router.post("/", protectVendor, createPromotion);
|
||||
router.put("/:id", protectVendor, updatePromotion);
|
||||
router.delete("/:id", protectVendor, deletePromotion);
|
||||
|
||||
// Public route for validating a promotion code
|
||||
router.post("/validate/:storeId", validatePromotion);
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user