wms-be/modules/product/dto/product_dto.go

133 lines
5.4 KiB
Go

package dto
import (
"errors"
)
const (
MESSAGE_FAILED_CREATE_PRODUCT = "failed create product"
MESSAGE_SUCCESS_CREATE_PRODUCT = "success create product"
MESSAGE_FAILED_GET_PRODUCT = "failed get product"
MESSAGE_SUCCESS_GET_PRODUCT = "success get product"
MESSAGE_FAILED_UPDATE_PRODUCT = "failed update product"
MESSAGE_SUCCESS_UPDATE_PRODUCT = "success update product"
MESSAGE_FAILED_DELETE_PRODUCT = "failed delete product"
MESSAGE_SUCCESS_DELETE_PRODUCT = "success delete product"
MESSAGE_FAILED_GET_DATA_FROM_BODY = "failed get data from body"
)
var (
ErrCreateProduct = errors.New("failed to create product")
ErrGetProductById = errors.New("failed to get product by id")
ErrUpdateProduct = errors.New("failed to update product")
ErrDeleteProduct = errors.New("failed to delete product")
)
type (
ProductCreateRequest struct {
Name string `json:"name" binding:"required"`
RefNumber string `json:"ref_number" binding:"required"`
SKU string `json:"sku" binding:"required"`
Description string `json:"description"`
Status string `json:"status" binding:"required"`
IsReturnable bool `json:"is_returnable"`
DimLength float64 `json:"dim_length"`
DimWidth float64 `json:"dim_width"`
DimHeight float64 `json:"dim_height"`
Weight float64 `json:"weight"`
Volume float64 `json:"volume"`
MaxStackHeight int `json:"max_stack_height"`
Temperature string `json:"temperature"`
IsHazardous bool `json:"is_hazardous"`
MinStock int `json:"min_stock"`
MaxStock int `json:"max_stock"`
ReplenishType string `json:"replenish_type"`
CycleCount string `json:"cycle_count"`
LotRules string `json:"lot_rules"`
LeadTime int `json:"lead_time"`
MultiplyRate string `json:"multiply_rate"`
DivideRate float64 `json:"divide_rate"`
ClientID string `json:"client_id" binding:"required"`
CategoryID string `json:"category_id"`
UomID string `json:"uom_id"`
DimUomID string `json:"dim_uom_id"`
WeightUomID string `json:"weight_uom_id"`
VolumeUomID string `json:"volume_uom_id"`
MinStockUomID string `json:"min_stock_uom_id"`
MaxStockUomID string `json:"max_stock_uom_id"`
LeadTimeUomID string `json:"lead_time_uom_id"`
UomToUomID string `json:"uom_to_uom_id"`
}
ProductUpdateRequest struct {
Name *string `json:"name"`
RefNumber *string `json:"ref_number"`
SKU *string `json:"sku"`
Description *string `json:"description"`
Status *string `json:"status"`
IsReturnable *bool `json:"is_returnable"`
DimLength *float64 `json:"dim_length"`
DimWidth *float64 `json:"dim_width"`
DimHeight *float64 `json:"dim_height"`
Weight *float64 `json:"weight"`
Volume *float64 `json:"volume"`
MaxStackHeight *int `json:"max_stack_height"`
Temperature *string `json:"temperature"`
IsHazardous *bool `json:"is_hazardous"`
MinStock *int `json:"min_stock"`
MaxStock *int `json:"max_stock"`
ReplenishType *string `json:"replenish_type"`
CycleCount *string `json:"cycle_count"`
LotRules *string `json:"lot_rules"`
LeadTime *int `json:"lead_time"`
MultiplyRate *string `json:"multiply_rate"`
DivideRate *float64 `json:"divide_rate"`
ClientID *string `json:"client_id"`
CategoryID *string `json:"category_id"`
UomID *string `json:"uom_id"`
DimUomID *string `json:"dim_uom_id"`
WeightUomID *string `json:"weight_uom_id"`
VolumeUomID *string `json:"volume_uom_id"`
MinStockUomID *string `json:"min_stock_uom_id"`
MaxStockUomID *string `json:"max_stock_uom_id"`
LeadTimeUomID *string `json:"lead_time_uom_id"`
UomToUomID *string `json:"uom_to_uom_id"`
}
ProductResponse struct {
ID string `json:"id"`
Name string `json:"name"`
RefNumber string `json:"ref_number"`
SKU string `json:"sku"`
Description string `json:"description"`
Status string `json:"status"`
IsReturnable bool `json:"is_returnable"`
DimLength float64 `json:"dim_length"`
DimWidth float64 `json:"dim_width"`
DimHeight float64 `json:"dim_height"`
Weight float64 `json:"weight"`
Volume float64 `json:"volume"`
MaxStackHeight int `json:"max_stack_height"`
Temperature string `json:"temperature"`
IsHazardous bool `json:"is_hazardous"`
MinStock int `json:"min_stock"`
MaxStock int `json:"max_stock"`
ReplenishType string `json:"replenish_type"`
CycleCount string `json:"cycle_count"`
LotRules string `json:"lot_rules"`
LeadTime int `json:"lead_time"`
MultiplyRate string `json:"multiply_rate"`
DivideRate float64 `json:"divide_rate"`
ClientID string `json:"client_id"`
CategoryID string `json:"category_id"`
UomID string `json:"uom_id"`
DimUomID string `json:"dim_uom_id"`
WeightUomID string `json:"weight_uom_id"`
VolumeUomID string `json:"volume_uom_id"`
MinStockUomID string `json:"min_stock_uom_id"`
MaxStockUomID string `json:"max_stock_uom_id"`
LeadTimeUomID string `json:"lead_time_uom_id"`
UomToUomID string `json:"uom_to_uom_id"`
}
)