Files
ember-market-frontend/backend/routes/promotion.routes.js
2025-03-10 17:39:37 +00:00

24 lines
761 B
JavaScript

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;