Skip to content

Commit

Permalink
updates on inventory to add supplier
Browse files Browse the repository at this point in the history
  • Loading branch information
drseveriano committed Nov 11, 2024
1 parent 58f0e1a commit 4113f93
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main/java/model/Inventory.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public class Inventory extends AuditEntity implements Serializable {
@ManyToOne(optional = false, fetch = FetchType.LAZY)
private Item item;

@ManyToOne(fetch = FetchType.LAZY)
private Supplier supplier;

private InventoryType inventoryType;

@Column(nullable = false)
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/records/InventoryManualRequest.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package records;

import enums.InventoryType;
import model.Supplier;
import model.Warehouse;

import java.math.BigDecimal;

public record InventoryManualRequest(Integer itemId, Warehouse warehouse, InventoryType inventoryType, int quantity,
public record InventoryManualRequest(Integer itemId, Supplier supplier, Warehouse warehouse,
InventoryType inventoryType, int quantity,
int minQuantity, boolean alertLowStock, Integer unitId,
BigDecimal costPrice, String notes) {
}
1 change: 1 addition & 0 deletions src/main/java/service/InventoryService.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class InventoryService {
@Transactional
public boolean createManualEntryOnInventory(InventoryManualRequest request) {
Inventory.builder()
.supplier(request.supplier())
.warehouse(request.warehouse())
.item(itemService.findById(request.itemId()))
.inventoryType(request.inventoryType())
Expand Down

0 comments on commit 4113f93

Please sign in to comment.