Add supply purchase order workflow
This commit is contained in:
@@ -5,13 +5,16 @@ const {
|
||||
approveReceipt,
|
||||
consumeLotForProduction,
|
||||
createFabricPlan,
|
||||
createPurchaseOrder,
|
||||
createReceipt,
|
||||
deleteFabricPlan,
|
||||
deleteReceipt,
|
||||
getSupplySummary,
|
||||
listFabricPlans,
|
||||
listKnownSuppliers,
|
||||
listPurchaseOrders,
|
||||
saveMaterialDetails,
|
||||
updatePurchaseOrderStatus,
|
||||
listLots,
|
||||
listMovements,
|
||||
listPurchaseNeeds,
|
||||
@@ -36,6 +39,30 @@ router.get('/supply/suppliers', verifyToken, async (req, res, next) => {
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/supply/purchase-orders', verifyToken, async (req, res, next) => {
|
||||
try {
|
||||
res.json(await listPurchaseOrders());
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
});
|
||||
|
||||
router.post('/supply/purchase-orders', verifyToken, async (req, res, next) => {
|
||||
try {
|
||||
res.status(201).json(await createPurchaseOrder(req.body || {}));
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
});
|
||||
|
||||
router.patch('/supply/purchase-orders/:id/status', verifyToken, async (req, res, next) => {
|
||||
try {
|
||||
res.json(await updatePurchaseOrderStatus(req.params.id, req.body?.status));
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/supply/receipts', verifyToken, async (req, res, next) => {
|
||||
try {
|
||||
res.json(await listReceipts());
|
||||
|
||||
Reference in New Issue
Block a user