Fix/adjust reservations correctly (#3474)

**What**
- Adjust reservations correctly according to the following heuristic: 

adjustment by addition:  (i.e. positive quantity adjustment passed to the adjustment method)
- if a reservation for the line-item in the location exists add quantity to that
- if not create a new reservation

adjustment by subtraction: 
- if a reservation with the exact quantity exists, delete it and return
- if a reservation with a greater quantity exists, subtract from it and return 
- otherwise delete from reservations until a reservation with greater quantity than the remaining is found and adjust that with the remaining quantity OR there are no more reservations

Fixes CORE-1247
This commit is contained in:
Philip Korsholm
2023-03-16 09:47:54 +00:00
committed by GitHub
parent 38c8d49f46
commit 02c77d7059
9 changed files with 392 additions and 102 deletions
@@ -75,7 +75,7 @@ export interface IInventoryService {
deleteReservationItemsByLineItem(lineItemId: string): Promise<void>
deleteReservationItem(reservationItemId: string): Promise<void>
deleteReservationItem(reservationItemId: string | string[]): Promise<void>
deleteInventoryItem(inventoryItemId: string): Promise<void>