api/resources/Affiliate&Coupon/Affiliate/AffiliateRoute.js
2024-05-30 13:28:34 +05:30

81 lines
1.5 KiB
JavaScript

import express from "express";
import {
MyAllAffiliate,
affiliatPayOut,
affiliatePayHistory,
createAffiliate,
editAffiliate,
getOneAffiliate,
getOneAffiliateForPay,
listAllAffiliate,
payAffiliate,
suspendAffiliate,
} from "./AffiliateController.js";
import {
isAuthenticatedUser,
authorizeRoles,
} from "../../../middlewares/auth.js";
const router = express.Router();
router.post(
"/create",
isAuthenticatedUser,
authorizeRoles("admin", "Employee"),
createAffiliate
);
router.get(
"/getall",
isAuthenticatedUser,
authorizeRoles("admin", "Employee"),
listAllAffiliate
);
router.get("/my/:id", isAuthenticatedUser, MyAllAffiliate);
router.get(
"/getone/:id",
isAuthenticatedUser,
authorizeRoles("admin", "Employee"),
getOneAffiliate
);
router.patch(
"/edit/:id",
isAuthenticatedUser,
authorizeRoles("admin", "Employee"),
editAffiliate
);
router.patch(
"/suspend",
isAuthenticatedUser,
authorizeRoles("admin", "Employee"),
suspendAffiliate
);
router.post(
"/pay/:id",
isAuthenticatedUser,
authorizeRoles("admin", "Employee"),
payAffiliate
);
router.get(
"/getpay/:id",
isAuthenticatedUser,
authorizeRoles("admin", "Employee"),
getOneAffiliateForPay
);
router.get(
"/history/:id",
isAuthenticatedUser,
authorizeRoles("admin", "Employee"),
affiliatePayHistory
);
//pay affiliat Amount by razorpay
router.post(
"/payout",
isAuthenticatedUser,
authorizeRoles("admin", "Employee"),
affiliatPayOut
);
export default router;