Dealer_Onboarding_Backend/routes/resignations.js

63 lines
1.3 KiB
JavaScript

const express = require('express');
const router = express.Router();
const resignationController = require('../controllers/resignationController');
const { authenticate } = require('../middleware/auth');
const { checkRole } = require('../middleware/roleCheck');
const { ROLES } = require('../config/constants');
// Create resignation (Dealer only)
router.post(
'/create',
authenticate,
checkRole([ROLES.DEALER]),
resignationController.createResignation
);
// Get resignations list (role-based filtering)
router.get(
'/list',
authenticate,
resignationController.getResignations
);
// Get resignation by ID
router.get(
'/:id',
authenticate,
resignationController.getResignationById
);
// Approve resignation (specific roles only)
router.post(
'/:id/approve',
authenticate,
checkRole([
ROLES.RBM,
ROLES.ZBH,
ROLES.NBH,
ROLES.DD_ADMIN,
ROLES.LEGAL_ADMIN,
ROLES.FINANCE,
ROLES.SUPER_ADMIN
]),
resignationController.approveResignation
);
// Reject resignation (specific roles only)
router.post(
'/:id/reject',
authenticate,
checkRole([
ROLES.RBM,
ROLES.ZBH,
ROLES.NBH,
ROLES.DD_ADMIN,
ROLES.LEGAL_ADMIN,
ROLES.FINANCE,
ROLES.SUPER_ADMIN
]),
resignationController.rejectResignation
);
module.exports = router;