mirror of
https://github.com/Alvin-Zilverstand/Challenge_15_Magazijn_App_Maken.git
synced 2026-03-06 11:06:34 +01:00
Enhance reservation management: add 'Mark Returned' button and update return status handling
This commit is contained in:
@@ -150,7 +150,11 @@ router.patch('/:id', auth, async (req, res) => {
|
||||
item.reserved = Math.max(0, item.reserved - (reservation.quantity || 1));
|
||||
await item.save();
|
||||
} else if (oldStatus === 'RETURN_PENDING' && newStatus === 'RETURNED') {
|
||||
// Admin approved the return
|
||||
// Admin approved the return request
|
||||
item.reserved = Math.max(0, item.reserved - (reservation.quantity || 1));
|
||||
await item.save();
|
||||
} else if (oldStatus === 'APPROVED' && newStatus === 'RETURNED') {
|
||||
// Admin directly marked approved item as returned
|
||||
item.reserved = Math.max(0, item.reserved - (reservation.quantity || 1));
|
||||
await item.save();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user