init
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
package contract
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// Inventory Request DTOs
|
||||
type CreateInventoryRequest struct {
|
||||
OutletID uuid.UUID `json:"outlet_id" validate:"required"`
|
||||
ProductID uuid.UUID `json:"product_id" validate:"required"`
|
||||
Quantity int `json:"quantity" validate:"min=0"`
|
||||
ReorderLevel int `json:"reorder_level" validate:"min=0"`
|
||||
}
|
||||
|
||||
type UpdateInventoryRequest struct {
|
||||
Quantity *int `json:"quantity,omitempty" validate:"omitempty,min=0"`
|
||||
ReorderLevel *int `json:"reorder_level,omitempty" validate:"omitempty,min=0"`
|
||||
}
|
||||
|
||||
type AdjustInventoryRequest struct {
|
||||
ProductID uuid.UUID `json:"product_id" validate:"required"`
|
||||
OutletID uuid.UUID `json:"outlet_id" validate:"required"`
|
||||
Delta int `json:"delta" validate:"required"` // Can be positive or negative
|
||||
Reason string `json:"reason" validate:"required,min=1,max=255"`
|
||||
}
|
||||
|
||||
type ListInventoryRequest struct {
|
||||
OutletID *uuid.UUID `json:"outlet_id,omitempty"`
|
||||
ProductID *uuid.UUID `json:"product_id,omitempty"`
|
||||
CategoryID *uuid.UUID `json:"category_id,omitempty"`
|
||||
LowStockOnly *bool `json:"low_stock_only,omitempty"`
|
||||
ZeroStockOnly *bool `json:"zero_stock_only,omitempty"`
|
||||
Search string `json:"search,omitempty"`
|
||||
Page int `json:"page" validate:"required,min=1"`
|
||||
Limit int `json:"limit" validate:"required,min=1,max=100"`
|
||||
}
|
||||
|
||||
// Inventory Response DTOs
|
||||
type InventoryResponse struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
OutletID uuid.UUID `json:"outlet_id"`
|
||||
ProductID uuid.UUID `json:"product_id"`
|
||||
Quantity int `json:"quantity"`
|
||||
ReorderLevel int `json:"reorder_level"`
|
||||
IsLowStock bool `json:"is_low_stock"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
|
||||
// Related data (optional)
|
||||
Product *ProductResponse `json:"product,omitempty"`
|
||||
Outlet *OutletResponse `json:"outlet,omitempty"`
|
||||
}
|
||||
|
||||
type ListInventoryResponse struct {
|
||||
Inventory []InventoryResponse `json:"inventory"`
|
||||
TotalCount int `json:"total_count"`
|
||||
Page int `json:"page"`
|
||||
Limit int `json:"limit"`
|
||||
TotalPages int `json:"total_pages"`
|
||||
}
|
||||
|
||||
type InventoryAdjustmentResponse struct {
|
||||
InventoryID uuid.UUID `json:"inventory_id"`
|
||||
ProductID uuid.UUID `json:"product_id"`
|
||||
OutletID uuid.UUID `json:"outlet_id"`
|
||||
PreviousQty int `json:"previous_quantity"`
|
||||
NewQty int `json:"new_quantity"`
|
||||
Delta int `json:"delta"`
|
||||
Reason string `json:"reason"`
|
||||
AdjustedAt time.Time `json:"adjusted_at"`
|
||||
}
|
||||
Reference in New Issue
Block a user