Add category edit action

This commit is contained in:
Cauê Faleiros
2026-08-10 11:15:15 -03:00
parent 4556659fcf
commit e85dbe6f10
4 changed files with 94 additions and 11 deletions

View File

@@ -10,7 +10,8 @@ const {
getCatalogSummary,
listCategories,
listConsumptionReferences,
listProducts
listProducts,
updateCategory
} = require('../services/catalogService');
const { importTinyProductCompositionExport } = require('../services/productionOrderService');
@@ -40,6 +41,14 @@ router.post('/catalog/categories', verifyToken, async (req, res, next) => {
}
});
router.put('/catalog/categories/:id', verifyToken, async (req, res, next) => {
try {
res.json(await updateCategory(req.params.id, req.body || {}));
} catch (error) {
next(error);
}
});
router.delete('/catalog/categories/:id', verifyToken, async (req, res, next) => {
try {
await deleteCategory(req.params.id);