import express from "express"; import { 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 ); export default router;