const express = require('express');
const router = express.Router({ mergeParams: true });
const tasksController = require('../controllers/tasks.controller');
const { authenticate, readOnlyForAuditor } = require('../middleware/auth.middleware');

router.use(authenticate);
router.get('/', tasksController.getByProject);
router.get('/:id', tasksController.getById);
router.post('/', readOnlyForAuditor, tasksController.create);
router.patch('/:id', readOnlyForAuditor, tasksController.update);
router.patch('/:id/status', readOnlyForAuditor, tasksController.updateStatus);
router.post('/:id/comments', tasksController.addComment);
module.exports = router;
