const express = require('express');
const UnitController = require('../controllers/unit.controller');
const verifyToken = require('../middleware/verifyToken');
const verifyAccess = require('../middleware/verifyAccess');

const router = express.Router();

router.route('/')
  .get(verifyToken.verifyAccessToken, UnitController.getAll)
  .post(verifyToken.verifyAccessToken, verifyAccess(), UnitController.create);

router.route('/:id')
  .get(verifyToken.verifyAccessToken, UnitController.getById)
  .put(verifyToken.verifyAccessToken, verifyAccess(), UnitController.update)
  .delete(verifyToken.verifyAccessToken, verifyAccess(), UnitController.delete);

module.exports = router;
