change id into code for device and material order item

This commit is contained in:
dpurbosakti
2025-11-10 16:29:03 +07:00
parent 9479a67493
commit 8d301af4e3
8 changed files with 51 additions and 48 deletions

No files matched your search

@@ -8,7 +8,7 @@ import (
type CreateDto struct {
MaterialOrder_Id *uint `json:"materialOrder_id"`
Material_Id *uint `json:"material_id"`
Material_Code *string `json:"material_code"`
Count *uint16 `json:"count"`
}
@@ -20,7 +20,7 @@ type ReadListDto struct {
type FilterDto struct {
MaterialOrder_Id *uint `json:"materialOrder-id"`
Material_Id *uint `json:"material-id"`
Material_Code *string `json:"material-code"`
Count *uint16 `json:"count"`
}
type ReadDetailDto struct {
@@ -46,7 +46,7 @@ type ResponseDto struct {
ecore.Main
MaterialOrder_Id *uint `json:"materialOrder_id"`
MaterialOrder *emo.MaterialOrder `json:"materialOrder,omitempty"`
Material_Id *uint `json:"material_id"`
Material_Code *string `json:"material_code"`
Material *em.Material `json:"material,omitempty"`
Count *uint16 `json:"count"`
}
@@ -55,7 +55,7 @@ func (d MaterialOrderItem) ToResponse() ResponseDto {
resp := ResponseDto{
MaterialOrder_Id: d.MaterialOrder_Id,
MaterialOrder: d.MaterialOrder,
Material_Id: d.Material_Id,
Material_Code: d.Material_Code,
Material: d.Material,
Count: d.Count,
}
@@ -10,8 +10,7 @@ type MaterialOrderItem struct {
ecore.Main // adjust this according to the needs
MaterialOrder_Id *uint `json:"materialOrder_id"`
MaterialOrder *emo.MaterialOrder `json:"materialOrder,omitempty" gorm:"foreignKey:MaterialOrder_Id;references:Id"`
Material_Id *uint `json:"material_id"`
Material_Code *string `json:"material_code"`
Material *em.Material `json:"material,omitempty" gorm:"foreignKey:Material_Id;references:Id"`
Material *em.Material `json:"material,omitempty" gorm:"foreignKey:Material_Code;references:Code"`
Count *uint16 `json:"count"`
}