/**
 * Project Routes
 */

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

const projectPerm = requireAdminOrPermission('tkuser.projects');

router.get('/product-types', requireAuth, projectController.getProductTypes);
router.get('/', requireAuth, projectController.getAll);
router.get('/active', requireAuth, projectController.getActive);
router.get('/:id', requireAuth, projectController.getById);
router.post('/', projectPerm, projectController.create);
router.put('/:id', projectPerm, projectController.update);
router.delete('/:id', projectPerm, projectController.remove);

module.exports = router;
