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

router.use(authenticate);

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

module.exports = router;
