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

153 lines
6.7 KiB
Go

package dto
import (
"errors"
pkgdto "github.com/Caknoooo/go-gin-clean-starter/pkg/dto"
)
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"
MESSAGE_FAILED_ASSIGN_CROSS_REF = "failed assign cross reference"
MESSAGE_SUCCESS_ASSIGN_CROSS_REF = "success assign cross reference"
MESSAGE_FAILED_REMOVE_CROSS_REF = "failed remove cross reference"
MESSAGE_SUCCESS_REMOVE_CROSS_REF = "success remove cross reference"
)
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")
ErrAssignCrossRef = errors.New("failed to assign cross reference")
ErrRemoveCrossRef = errors.New("failed to remove cross reference")
)
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"`
Client pkgdto.IdNameResponse `json:"client"`
Category pkgdto.IdNameResponse `json:"category"`
Uom pkgdto.IdNameResponse `json:"uom"`
DimUom pkgdto.IdNameResponse `json:"dim_uom"`
WeightUom pkgdto.IdNameResponse `json:"weight_uom"`
VolumeUom pkgdto.IdNameResponse `json:"volume_uom"`
MinStockUom pkgdto.IdNameResponse `json:"min_stock_uom"`
MaxStockUom pkgdto.IdNameResponse `json:"max_stock_uom"`
LeadTimeUom pkgdto.IdNameResponse `json:"lead_time_uom"`
UomToUom pkgdto.IdNameResponse `json:"uom_to_uom"`
CrossReferences []ProductVendorResponse `json:"cross_references"`
}
CrossReferenceRequest struct {
VendorIDs []string `json:"vendor_ids" binding:"required"`
}
ProductVendorResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Address string `json:"address"`
ContactPerson string `json:"contact_person"`
}
)