package entities import ( "github.com/google/uuid" ) type MProductEntity struct { ID uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4()" json:"id"` Name string `gorm:"type:varchar(255);not null" json:"name"` RefNumber string `gorm:"type:varchar(100);not null;uniqueIndex:idx_product_refnumber_client" json:"ref_number"` SKU string `gorm:"type:varchar(100);not null;uniqueIndex:idx_product_sku_client" json:"sku"` Description string `gorm:"type:text" json:"description"` Status string `gorm:"type:varchar(50);not null" json:"status"` IsReturnable bool `gorm:"type:boolean;default:false" json:"is_returnable"` DimLength float64 `gorm:"type:decimal(10,2);" json:"dim_length"` DimWidth float64 `gorm:"type:decimal(10,2);" json:"dim_width"` DimHeight float64 `gorm:"type:decimal(10,2);" json:"dim_height"` Weight float64 `gorm:"type:decimal(10,2);" json:"weight"` Volume float64 `gorm:"type:decimal(10,2);" json:"volume"` MaxStackHeight int `gorm:"type:int;" json:"max_stack_height"` Temperature string `gorm:"type:varchar(50)" json:"temperature"` IsHazardous bool `gorm:"type:boolean;default:false" json:"is_hazardous"` MinStock int `gorm:"type:int;default:0" json:"min_stock"` MaxStock int `gorm:"type:int;default:0" json:"max_stock"` ReplenishType string `gorm:"type:varchar(50)" json:"replenish_type"` CycleCount string `gorm:"type:varchar(50);default:0" json:"cycle_count"` LotRules string `gorm:"type:varchar(100)" json:"lot_rules"` LeadTime int `gorm:"type:int;default:0" json:"lead_time"` MultiplyRate string `gorm:"type:varchar(50)" json:"multiply_rate"` DivideRate float64 `gorm:"type:decimal(10,2)" json:"divide_rate"` ClientID uuid.UUID `gorm:"type:uuid;index;uniqueIndex:idx_product_refnumber_client,uniqueIndex:idx_product_sku_client" json:"client_id"` CategoryID uuid.UUID `gorm:"type:uuid;index" json:"category_id"` UomID uuid.UUID `gorm:"type:uuid;index" json:"uom_id"` DimUomID uuid.UUID `gorm:"type:uuid;index" json:"dim_uom_id"` WeightUomID uuid.UUID `gorm:"type:uuid;index" json:"weight_uom_id"` VolumeUomID uuid.UUID `gorm:"type:uuid;index" json:"volume_uom_id"` MinStockUomID uuid.UUID `gorm:"type:uuid;index" json:"min_stock_uom_id"` MaxStockUomID uuid.UUID `gorm:"type:uuid;index" json:"max_stock_uom_id"` LeadTimeUomID uuid.UUID `gorm:"type:uuid;index" json:"lead_time_uom_id"` UomToUomID uuid.UUID `gorm:"type:uuid;index" json:"uom_to_uom_id"` Client M_Client `gorm:"foreignKey:ClientID;references:ID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"` // Category M_Category `gorm:"foreignKey:CategoryID;references:ID"` // Uom M_Uom `gorm:"foreignKey:UomID;references:ID"` // DimUom M_Uom `gorm:"foreignKey:DimUomID;references:ID"` // WeightUom M_Uom `gorm:"foreignKey:WeightUomID;references:ID"` // VolumeUom M_Uom `gorm:"foreignKey:VolumeUomID;references:ID"` // MinStockUom M_Uom `gorm:"foreignKey:MinStockUomID;references:ID"` // MaxStockUom M_Uom `gorm:"foreignKey:MaxStockUomID;references:ID"` // LeadTimeUom M_Uom `gorm:"foreignKey:LeadTimeUomID;references:ID"` // UomToUom M_Uom `gorm:"foreignKey:UomToUomID;references:ID"` FullAuditTrail } func (MProductEntity) TableName() string { return "m_products" }