78 lines
1.4 KiB
JavaScript
78 lines
1.4 KiB
JavaScript
import express from "express";
|
|
import {
|
|
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(
|
|
"/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;
|