mirror of
https://github.com/Alvin-Zilverstand/Challenge_15_Magazijn_App_Maken.git
synced 2026-12-03 10:11:24 +01:00
Enhance reservation management: add 'Mark Returned' button and update return status handling
This commit is contained in:
1 parent
cb2a0b4344
commit
de1930e5a3
2 files changed
+8
-2
No files matched your search
@@ -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