Re_Backend/src/routes/dashboard.routes.ts

83 lines
2.3 KiB
TypeScript

import { Router } from 'express';
import type { Request, Response } from 'express';
import { DashboardController } from '../controllers/dashboard.controller';
import { authenticateToken } from '../middlewares/auth.middleware';
import { asyncHandler } from '../middlewares/errorHandler.middleware';
const router = Router();
const dashboardController = new DashboardController();
/**
* Dashboard Routes
* All routes require authentication
*/
// Get KPI summary (all KPI cards)
router.get('/kpis',
authenticateToken,
asyncHandler(dashboardController.getKPIs.bind(dashboardController))
);
// Get detailed request statistics
router.get('/stats/requests',
authenticateToken,
asyncHandler(dashboardController.getRequestStats.bind(dashboardController))
);
// Get TAT efficiency metrics
router.get('/stats/tat-efficiency',
authenticateToken,
asyncHandler(dashboardController.getTATEfficiency.bind(dashboardController))
);
// Get approver load statistics
router.get('/stats/approver-load',
authenticateToken,
asyncHandler(dashboardController.getApproverLoad.bind(dashboardController))
);
// Get engagement & quality metrics
router.get('/stats/engagement',
authenticateToken,
asyncHandler(dashboardController.getEngagementStats.bind(dashboardController))
);
// Get AI & closure insights
router.get('/stats/ai-insights',
authenticateToken,
asyncHandler(dashboardController.getAIInsights.bind(dashboardController))
);
// Get recent activity feed
router.get('/activity/recent',
authenticateToken,
asyncHandler(dashboardController.getRecentActivity.bind(dashboardController))
);
// Get high priority/critical requests
router.get('/requests/critical',
authenticateToken,
asyncHandler(dashboardController.getCriticalRequests.bind(dashboardController))
);
// Get upcoming deadlines
router.get('/deadlines/upcoming',
authenticateToken,
asyncHandler(dashboardController.getUpcomingDeadlines.bind(dashboardController))
);
// Get department-wise summary
router.get('/stats/by-department',
authenticateToken,
asyncHandler(dashboardController.getDepartmentStats.bind(dashboardController))
);
// Get priority distribution
router.get('/stats/priority-distribution',
authenticateToken,
asyncHandler(dashboardController.getPriorityDistribution.bind(dashboardController))
);
export default router;