103 lines
2.6 KiB
JavaScript
103 lines
2.6 KiB
JavaScript
// import express from "express";
|
|
// import {
|
|
// markAttendance,
|
|
// getAttendanceBySalesCoordinator,
|
|
// getTodayAttendance,
|
|
// AdmingetAttendanceBySalesCoordinator,
|
|
// } from "./AttandanceController.js";
|
|
// import { isAuthenticatedSalesCoOrdinator } from "../../middlewares/SalesCoOrdinatorAuth.js";
|
|
// import { authorizeRoles, isAuthenticatedUser } from "../../middlewares/auth.js";
|
|
|
|
// const router = express.Router();
|
|
|
|
// // Place more specific routes first
|
|
|
|
// // Route to get today's attendance for admin
|
|
// router.get(
|
|
// "/attendance/today",
|
|
// isAuthenticatedUser,
|
|
// authorizeRoles("admin"),
|
|
// getTodayAttendance
|
|
// );
|
|
|
|
// // Route to mark attendance
|
|
// router.post("/attendance", isAuthenticatedSalesCoOrdinator, markAttendance);
|
|
|
|
// // Route to get attendance for the logged-in sales coordinator
|
|
// router.get(
|
|
// "/attendance",
|
|
// isAuthenticatedSalesCoOrdinator,
|
|
// getAttendanceBySalesCoordinator
|
|
// );
|
|
|
|
// // Admin route to get attendance by sales coordinator ID
|
|
// router.get(
|
|
// "/attendance/:id",
|
|
// isAuthenticatedUser,
|
|
// authorizeRoles("admin"),
|
|
// AdmingetAttendanceBySalesCoordinator
|
|
// );
|
|
|
|
// export default router;
|
|
|
|
import express from "express";
|
|
import {
|
|
markAttendance,
|
|
getAttendanceByUser,
|
|
getTodayAttendance,
|
|
AdmingetAttendanceByUser,
|
|
} from "./AttendanceController.js";
|
|
import { isAuthenticatedSalesCoOrdinator } from "../../middlewares/SalesCoOrdinatorAuth.js";
|
|
// import { isAuthenticatedTerritoryManager } from "../../middlewares/TerritoryManagerAuth.js";
|
|
import { authorizeRoles, isAuthenticatedUser } from "../../middlewares/auth.js";
|
|
|
|
const router = express.Router();
|
|
|
|
// Place more specific routes first
|
|
|
|
// Route to get today's attendance for admin
|
|
router.get(
|
|
"/attendance/today",
|
|
isAuthenticatedUser,
|
|
authorizeRoles("admin"),
|
|
getTodayAttendance
|
|
);
|
|
|
|
// Route to mark attendance for Sales Coordinators
|
|
router.post(
|
|
"/attendance/salescoordinator",
|
|
isAuthenticatedSalesCoOrdinator,
|
|
markAttendance
|
|
);
|
|
|
|
// Route to mark attendance for Territory Managers
|
|
router.post(
|
|
"/attendance/territorymanager",
|
|
// isAuthenticatedTerritoryManager,
|
|
markAttendance
|
|
);
|
|
|
|
// Route to get attendance for the logged-in sales coordinator
|
|
router.get(
|
|
"/attendance/salescoordinator",
|
|
isAuthenticatedSalesCoOrdinator,
|
|
getAttendanceByUser
|
|
);
|
|
|
|
// Route to get attendance for the logged-in territory manager
|
|
router.get(
|
|
"/attendance/territorymanager",
|
|
// isAuthenticatedTerritoryManager,
|
|
getAttendanceByUser
|
|
);
|
|
|
|
// Admin route to get attendance by user ID
|
|
router.get(
|
|
"/attendance/:id",
|
|
isAuthenticatedUser,
|
|
authorizeRoles("admin"),
|
|
AdmingetAttendanceByUser
|
|
);
|
|
|
|
export default router;
|