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
|
|
@ -51,6 +51,7 @@ type MProductEntity struct {
|
||||||
LeadTimeUom MUomEntity `gorm:"foreignKey:LeadTimeUomID;references:ID"`
|
LeadTimeUom MUomEntity `gorm:"foreignKey:LeadTimeUomID;references:ID"`
|
||||||
UomToUom MUomEntity `gorm:"foreignKey:UomToUomID;references:ID"`
|
UomToUom MUomEntity `gorm:"foreignKey:UomToUomID;references:ID"`
|
||||||
CrossReferences []MCrossReferenceEntity `gorm:"foreignKey:ProductID;references:ID"`
|
CrossReferences []MCrossReferenceEntity `gorm:"foreignKey:ProductID;references:ID"`
|
||||||
|
InventoryTransactions []InventoryTransactionEntity `gorm:"foreignKey:ProductID;references:ID"`
|
||||||
|
|
||||||
FullAuditTrail
|
FullAuditTrail
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,7 @@ type (
|
||||||
LeadTimeUom pkgdto.IdNameResponse `json:"lead_time_uom"`
|
LeadTimeUom pkgdto.IdNameResponse `json:"lead_time_uom"`
|
||||||
UomToUom pkgdto.IdNameResponse `json:"uom_to_uom"`
|
UomToUom pkgdto.IdNameResponse `json:"uom_to_uom"`
|
||||||
CrossReferences []ProductVendorResponse `json:"cross_references"`
|
CrossReferences []ProductVendorResponse `json:"cross_references"`
|
||||||
|
InvTransactions []ProductInventoryTransactionResponse `json:"inv_transactions"`
|
||||||
}
|
}
|
||||||
|
|
||||||
CrossReferenceRequest struct {
|
CrossReferenceRequest struct {
|
||||||
|
|
@ -150,4 +151,9 @@ type (
|
||||||
Address string `json:"address"`
|
Address string `json:"address"`
|
||||||
ContactPerson string `json:"contact_person"`
|
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("UomToUom").
|
||||||
Preload("CrossReferences").
|
Preload("CrossReferences").
|
||||||
Preload("CrossReferences.Vendor").
|
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 {
|
First(&product, "id = ?", productId).Error; err != nil {
|
||||||
return product, err
|
return product, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue