Commit c7683d2
authored
feat: add removeQuantity action (#347)
This pull request introduces support for the `removeQuantity` action on
inventory entries, allowing quantities to be subtracted from stock. The
change includes both the implementation and a corresponding test to
ensure correct behavior.
**Inventory entry actions:**
* Added the `removeQuantity` action to the
`InventoryEntryUpdateHandler`, which decreases `quantityOnStock` and
`availableQuantity` by the specified amount, ensuring the values do not
go below zero. (`src/repositories/inventory-entry/actions.ts`,
[[1]](diffhunk://#diff-861d61030e0231fbe9a417cfd51139b676940efcdc4d0fae7f19e9487d3532f1R4)
[[2]](diffhunk://#diff-861d61030e0231fbe9a417cfd51139b676940efcdc4d0fae7f19e9487d3532f1R30-R40)
**Testing:**
* Added a test for the `removeQuantity` action to verify that the
inventory entry's quantities are updated correctly when the action is
used. (`src/services/inventory-entry.test.ts`,
[src/services/inventory-entry.test.tsR96-R110](diffhunk://#diff-b679eb4155c512751fad7a0fd2f910a54086c7097ddbbcdfb4cd4ebe4a9cfde3R96-R110))
**Documentation:**
* Updated the changeset to document the addition of the `removeQuantity`
action for inventory entries. (`.changeset/old-sites-clean.md`,
[.changeset/old-sites-clean.mdR1-R5](diffhunk://#diff-27612412040630d66d6bec197223f696b30cebc93747a1ac4d46e39656b4f041R1-R5))1 parent cfbc4ac commit c7683d2
File tree
3 files changed
+32
-0
lines changed- .changeset
- src
- repositories/inventory-entry
- services
3 files changed
+32
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
29 | 41 | | |
30 | 42 | | |
31 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
96 | 111 | | |
97 | 112 | | |
98 | 113 | | |
| |||
0 commit comments