feat: add inventory transaction details to product entity and response, and update repository preload logic
Deploy Application / deploy (push) Successful in 26s
Details
Deploy Application / deploy (push) Successful in 26s
Details
This commit is contained in:
parent
f7eab339b6
commit
15dce0f540
|
|
@ -40,17 +40,18 @@ type MProductEntity struct {
|
|||
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 MCategoryEntity `gorm:"foreignKey:CategoryID;references:ID"`
|
||||
Uom MUomEntity `gorm:"foreignKey:UomID;references:ID"`
|
||||
DimUom MUomEntity `gorm:"foreignKey:DimUomID;references:ID"`
|
||||
WeightUom MUomEntity `gorm:"foreignKey:WeightUomID;references:ID"`
|
||||
VolumeUom MUomEntity `gorm:"foreignKey:VolumeUomID;references:ID"`
|
||||
MinStockUom MUomEntity `gorm:"foreignKey:MinStockUomID;references:ID"`
|
||||
MaxStockUom MUomEntity `gorm:"foreignKey:MaxStockUomID;references:ID"`
|
||||
LeadTimeUom MUomEntity `gorm:"foreignKey:LeadTimeUomID;references:ID"`
|
||||
UomToUom MUomEntity `gorm:"foreignKey:UomToUomID;references:ID"`
|
||||
CrossReferences []MCrossReferenceEntity `gorm:"foreignKey:ProductID;references:ID"`
|
||||
Client M_Client `gorm:"foreignKey:ClientID;references:ID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
|
||||
Category MCategoryEntity `gorm:"foreignKey:CategoryID;references:ID"`
|
||||
Uom MUomEntity `gorm:"foreignKey:UomID;references:ID"`
|
||||
DimUom MUomEntity `gorm:"foreignKey:DimUomID;references:ID"`
|
||||
WeightUom MUomEntity `gorm:"foreignKey:WeightUomID;references:ID"`
|
||||
VolumeUom MUomEntity `gorm:"foreignKey:VolumeUomID;references:ID"`
|
||||
MinStockUom MUomEntity `gorm:"foreignKey:MinStockUomID;references:ID"`
|
||||
MaxStockUom MUomEntity `gorm:"foreignKey:MaxStockUomID;references:ID"`
|
||||
LeadTimeUom MUomEntity `gorm:"foreignKey:LeadTimeUomID;references:ID"`
|
||||
UomToUom MUomEntity `gorm:"foreignKey:UomToUomID;references:ID"`
|
||||
CrossReferences []MCrossReferenceEntity `gorm:"foreignKey:ProductID;references:ID"`
|
||||
InventoryTransactions []InventoryTransactionEntity `gorm:"foreignKey:ProductID;references:ID"`
|
||||
|
||||
FullAuditTrail
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,40 +103,41 @@ type (
|
|||
}
|
||||
|
||||
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"`
|
||||
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"`
|
||||
InvTransactions []ProductInventoryTransactionResponse `json:"inv_transactions"`
|
||||
}
|
||||
|
||||
CrossReferenceRequest struct {
|
||||
|
|
@ -150,4 +151,9 @@ type (
|
|||
Address string `json:"address"`
|
||||
ContactPerson string `json:"contact_person"`
|
||||
}
|
||||
|
||||
ProductInventoryTransactionResponse struct {
|
||||
ID string `json:"id"`
|
||||
TransactionType string `json:"transaction_type"`
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -116,6 +116,13 @@ func (r *productRepository) GetById(ctx context.Context, tx *gorm.DB, productId
|
|||
Preload("UomToUom").
|
||||
Preload("CrossReferences").
|
||||
Preload("CrossReferences.Vendor").
|
||||
Preload("InvTransactions").
|
||||
Preload("InvTransactions.Product").
|
||||
Preload("InvTransactions.Client").
|
||||
Preload("InvTransactions.Aisle").
|
||||
Preload("InvTransactions.InvReceipt").
|
||||
Preload("InvTransactions.InvIssue").
|
||||
Preload("InvTransactions.InvMove").
|
||||
First(&product, "id = ?", productId).Error; err != nil {
|
||||
return product, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue