const express = require('express'); const router = express.Router(); const { getStaffDashboardStats, getSupervisorDashboardStats, getAdminDashboardStats, getOverviewStats } = require('../controllers/statsController'); const { protect, staff, supervisor, admin } = require('../middleware/authMiddleware'); // One endpoint per dashboard — each returns exactly what that dashboard renders in a // single response instead of the dashboard making several separate calls (and, previously, // pulling full payments/events lists just to reduce them to a couple of numbers). router.get('/staff', protect, staff, getStaffDashboardStats); router.get('/supervisor', protect, supervisor, getSupervisorDashboardStats); router.get('/admin', protect, admin, getAdminDashboardStats); // Month-over-month KPIs + trend + top events, shared by the Admin and Supervisor dashboards. // Staff never sees financial data, so this has no staff-accessible route. router.get('/overview', protect, supervisor, getOverviewStats); module.exports = router;