add total out
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
package contract
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type CreateInventoryRequest struct {
|
||||
@@ -24,6 +25,18 @@ type AdjustInventoryRequest struct {
|
||||
Reason string `json:"reason" validate:"required,min=1,max=255"`
|
||||
}
|
||||
|
||||
type RestockInventoryRequest struct {
|
||||
OutletID uuid.UUID `json:"outlet_id" validate:"required"`
|
||||
Items []RestockItem `json:"items" validate:"required,min=1,dive"`
|
||||
Reason string `json:"reason" validate:"required,min=1,max=255"`
|
||||
}
|
||||
|
||||
type RestockItem struct {
|
||||
ItemID uuid.UUID `json:"item_id" validate:"required"`
|
||||
ItemType string `json:"item_type" validate:"required,oneof=PRODUCT INGREDIENT"`
|
||||
Quantity int `json:"quantity" validate:"required,min=1"`
|
||||
}
|
||||
|
||||
type ListInventoryRequest struct {
|
||||
OutletID *uuid.UUID `json:"outlet_id,omitempty"`
|
||||
ProductID *uuid.UUID `json:"product_id,omitempty"`
|
||||
@@ -68,25 +81,43 @@ type InventoryAdjustmentResponse struct {
|
||||
AdjustedAt time.Time `json:"adjusted_at"`
|
||||
}
|
||||
|
||||
type RestockInventoryResponse struct {
|
||||
OutletID uuid.UUID `json:"outlet_id"`
|
||||
Items []RestockItemResult `json:"items"`
|
||||
Reason string `json:"reason"`
|
||||
RestockedAt time.Time `json:"restocked_at"`
|
||||
}
|
||||
|
||||
type RestockItemResult struct {
|
||||
ItemID uuid.UUID `json:"item_id"`
|
||||
ItemType string `json:"item_type"`
|
||||
ItemName string `json:"item_name"`
|
||||
PreviousQty int `json:"previous_quantity"`
|
||||
NewQty int `json:"new_quantity"`
|
||||
AddedQty int `json:"added_quantity"`
|
||||
Success bool `json:"success"`
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
// Inventory Report Contracts
|
||||
type InventoryReportSummaryResponse struct {
|
||||
TotalProducts int `json:"total_products"`
|
||||
TotalIngredients int `json:"total_ingredients"`
|
||||
TotalValue float64 `json:"total_value"`
|
||||
LowStockProducts int `json:"low_stock_products"`
|
||||
LowStockIngredients int `json:"low_stock_ingredients"`
|
||||
ZeroStockProducts int `json:"zero_stock_products"`
|
||||
ZeroStockIngredients int `json:"zero_stock_ingredients"`
|
||||
TotalSoldProducts float64 `json:"total_sold_products"`
|
||||
TotalProducts int `json:"total_products"`
|
||||
TotalIngredients int `json:"total_ingredients"`
|
||||
TotalValue float64 `json:"total_value"`
|
||||
LowStockProducts int `json:"low_stock_products"`
|
||||
LowStockIngredients int `json:"low_stock_ingredients"`
|
||||
ZeroStockProducts int `json:"zero_stock_products"`
|
||||
ZeroStockIngredients int `json:"zero_stock_ingredients"`
|
||||
TotalSoldProducts float64 `json:"total_sold_products"`
|
||||
TotalSoldIngredients float64 `json:"total_sold_ingredients"`
|
||||
OutletID string `json:"outlet_id"`
|
||||
OutletName string `json:"outlet_name"`
|
||||
GeneratedAt string `json:"generated_at"`
|
||||
OutletID string `json:"outlet_id"`
|
||||
OutletName string `json:"outlet_name"`
|
||||
GeneratedAt string `json:"generated_at"`
|
||||
}
|
||||
|
||||
type InventoryReportDetailResponse struct {
|
||||
Summary *InventoryReportSummaryResponse `json:"summary"`
|
||||
Products []*InventoryProductDetailResponse `json:"products"`
|
||||
Summary *InventoryReportSummaryResponse `json:"summary"`
|
||||
Products []*InventoryProductDetailResponse `json:"products"`
|
||||
Ingredients []*InventoryIngredientDetailResponse `json:"ingredients"`
|
||||
}
|
||||
|
||||
@@ -95,29 +126,29 @@ type InventoryProductDetailResponse struct {
|
||||
ProductID string `json:"product_id"`
|
||||
ProductName string `json:"product_name"`
|
||||
CategoryName string `json:"category_name"`
|
||||
Quantity int `json:"quantity"`
|
||||
Quantity int `json:"quantity"`
|
||||
ReorderLevel int `json:"reorder_level"`
|
||||
UnitCost float64 `json:"unit_cost"`
|
||||
TotalValue float64 `json:"total_value"`
|
||||
TotalIn float64 `json:"total_in"`
|
||||
TotalOut float64 `json:"total_out"`
|
||||
IsLowStock bool `json:"is_low_stock"`
|
||||
IsZeroStock bool `json:"is_zero_stock"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
UnitCost float64 `json:"unit_cost"`
|
||||
TotalValue float64 `json:"total_value"`
|
||||
TotalIn float64 `json:"total_in"`
|
||||
TotalOut float64 `json:"total_out"`
|
||||
IsLowStock bool `json:"is_low_stock"`
|
||||
IsZeroStock bool `json:"is_zero_stock"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
}
|
||||
|
||||
type InventoryIngredientDetailResponse struct {
|
||||
ID string `json:"id"`
|
||||
IngredientID string `json:"ingredient_id"`
|
||||
IngredientName string `json:"ingredient_name"`
|
||||
UnitName string `json:"unit_name"`
|
||||
Quantity int `json:"quantity"`
|
||||
ReorderLevel int `json:"reorder_level"`
|
||||
UnitCost float64 `json:"unit_cost"`
|
||||
TotalValue float64 `json:"total_value"`
|
||||
TotalIn float64 `json:"total_in"`
|
||||
TotalOut float64 `json:"total_out"`
|
||||
IsLowStock bool `json:"is_low_stock"`
|
||||
IsZeroStock bool `json:"is_zero_stock"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
ID string `json:"id"`
|
||||
IngredientID string `json:"ingredient_id"`
|
||||
IngredientName string `json:"ingredient_name"`
|
||||
UnitName string `json:"unit_name"`
|
||||
Quantity int `json:"quantity"`
|
||||
ReorderLevel int `json:"reorder_level"`
|
||||
UnitCost float64 `json:"unit_cost"`
|
||||
TotalValue float64 `json:"total_value"`
|
||||
TotalIn float64 `json:"total_in"`
|
||||
TotalOut float64 `json:"total_out"`
|
||||
IsLowStock bool `json:"is_low_stock"`
|
||||
IsZeroStock bool `json:"is_zero_stock"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user