/**
 * Worker Routes
 */

const express = require('express');
const router = express.Router();
const workerController = require('../controllers/workerController');
const { requireAuth, requireAdminOrPermission } = require('../middleware/auth');

const workerPerm = requireAdminOrPermission('tkuser.workers');

router.get('/', requireAuth, workerController.getAll);
router.get('/:id', requireAuth, workerController.getById);
router.post('/', workerPerm, workerController.create);
router.put('/:id', workerPerm, workerController.update);
router.delete('/:id', workerPerm, workerController.remove);

module.exports = router;
