const router = require('express').Router();
const ctrl = require('../controllers/dailyEntry.controller');
const { authenticate } = require('../middlewares/auth');
const { validate } = require('../middlewares/validate');
const { dailyEntrySchemas, paramsSchemas } = require('../validators');

router.use(authenticate);

router.get('/', ctrl.getAll);
router.get('/:id', ctrl.getById);
router.post('/', validate({ body: dailyEntrySchemas.create }), ctrl.create);
router.put('/:id', validate({ params: paramsSchemas.idParam, body: dailyEntrySchemas.update }), ctrl.update);
router.delete('/:id', validate({ params: paramsSchemas.idParam }), ctrl.remove);

module.exports = router;
