const express = require('express'); const router = express.Router(); const { getEventCashup, getCashByRecordedUser, savePersonCash, saveEventCashupDraft, closeEvent, reopenEvent, resolvePending, getCashupAudit } = require('../controllers/cashupController'); const { protect, supervisor, admin } = require('../middleware/authMiddleware'); const { scopeEvent, scopeList } = require('../utils/campusScope'); router.get('/audit', protect, supervisor, scopeList, getCashupAudit); router.get('/event/:eventId', protect, supervisor, scopeEvent({ need: 'manage' }), getEventCashup); router.get('/event/:eventId/cash-by-user', protect, supervisor, scopeEvent({ need: 'manage' }), getCashByRecordedUser); router.put('/event/:eventId/person-cash/:userId', protect, supervisor, scopeEvent({ need: 'manage' }), savePersonCash); router.put('/event/:eventId/draft', protect, admin, saveEventCashupDraft); router.post('/event/:eventId/close', protect, admin, closeEvent); router.post('/event/:eventId/reopen', protect, admin, reopenEvent); router.post('/lines/:lineId/pending', protect, admin, resolvePending); module.exports = router;