Add editable registrations
This commit is contained in:
@@ -11,7 +11,9 @@ const {
|
||||
listCategories,
|
||||
listConsumptionReferences,
|
||||
listProducts,
|
||||
updateCategory
|
||||
updateCategory,
|
||||
updateConsumptionReference,
|
||||
updateProduct
|
||||
} = require('../services/catalogService');
|
||||
const { importTinyProductCompositionExport } = require('../services/productionOrderService');
|
||||
|
||||
@@ -74,6 +76,14 @@ router.post('/catalog/products', verifyToken, async (req, res, next) => {
|
||||
}
|
||||
});
|
||||
|
||||
router.put('/catalog/products/:id', verifyToken, async (req, res, next) => {
|
||||
try {
|
||||
res.json(await updateProduct(req.params.id, req.body || {}));
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
});
|
||||
|
||||
router.delete('/catalog/products/:id', verifyToken, async (req, res, next) => {
|
||||
try {
|
||||
await deleteProduct(req.params.id);
|
||||
@@ -99,6 +109,14 @@ router.post('/catalog/consumption-references', verifyToken, async (req, res, nex
|
||||
}
|
||||
});
|
||||
|
||||
router.put('/catalog/consumption-references/:id', verifyToken, async (req, res, next) => {
|
||||
try {
|
||||
res.json(await updateConsumptionReference(req.params.id, req.body || {}));
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
});
|
||||
|
||||
router.post('/catalog/product-compositions/import', verifyToken, async (req, res, next) => {
|
||||
try {
|
||||
res.status(201).json(await importTinyProductCompositionExport(req.body || {}));
|
||||
|
||||
Reference in New Issue
Block a user