const express = require('express');
const router = express.Router();
const ctrl = require('../controllers/consumableCategoryController');
const { createRequirePage } = require('../../../shared/middleware/pagePermission');
const { getDb } = require('../dbPool');
const requirePage = createRequirePage(getDb);

router.get('/', ctrl.getAll);
router.post('/', requirePage('factory_purchases'), ctrl.create);
router.put('/:id', requirePage('factory_purchases'), ctrl.update);
router.put('/:id/deactivate', requirePage('factory_purchases'), ctrl.deactivate);

module.exports = router;
