Merge branch 'migration' of github.com:dikstub-rssa/simrs-be into feat/medicine-mix-prescription-37
This commit is contained in:
@@ -59,11 +59,11 @@ type ResponseDto struct {
|
||||
|
||||
func (d McuSrc) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
CheckupCategory_Code: d.CheckupCategory_Code,
|
||||
Item_Id: d.Item_Id,
|
||||
Item: d.Item,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
// CheckupCategory_Code: d.CheckupCategory_Code,
|
||||
Item_Id: d.Item_Id,
|
||||
Item: d.Item,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
)
|
||||
|
||||
type McuSrc struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;size:20"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
CheckupCategory_Code *string `json:"checkupCategory_code" gorm:"size:20"`
|
||||
CheckupCategory *emsc.McuSrcCategory `json:"checkupCategory,omitempty" gorm:"foreignKey:CheckupCategory_Code;references:Code"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
|
||||
ecore.Main // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;size:20"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
McuSrcCategory_Code *string `json:"mcuSrcCategory_code" gorm:"size:20"`
|
||||
McuSrcCategory *emsc.McuSrcCategory `json:"mcuSrcCategory,omitempty" gorm:"foreignKey:McuSrcCategory_Code;references:Code"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
|
||||
}
|
||||
|
||||
@@ -5,17 +5,7 @@ Any functions that are used internally by the use-case
|
||||
package mcusrc
|
||||
|
||||
import (
|
||||
ei "simrs-vx/internal/domain/main-entities/item"
|
||||
e "simrs-vx/internal/domain/main-entities/mcu-src"
|
||||
|
||||
ui "simrs-vx/internal/use-case/main-use-case/item"
|
||||
|
||||
pl "simrs-vx/pkg/logger"
|
||||
pu "simrs-vx/pkg/use-case-helper"
|
||||
|
||||
ero "simrs-vx/internal/domain/references/organization"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.McuSrc) {
|
||||
@@ -29,23 +19,5 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.McuSrc) {
|
||||
|
||||
data.Code = inputSrc.Code
|
||||
data.Name = inputSrc.Name
|
||||
data.CheckupCategory_Code = inputSrc.CheckupCategory_Code
|
||||
data.Item_Id = inputSrc.Item_Id
|
||||
}
|
||||
|
||||
func createItem(input *e.CreateDto, event *pl.Event, tx *gorm.DB) error {
|
||||
itemCreate := ei.CreateDto{
|
||||
Code: pu.AddPrefix("mcu-", input.Code),
|
||||
Name: input.Name,
|
||||
ItemGroup_Code: ero.ITGCMCU,
|
||||
// Uom_Code: &input.Uom_Code,
|
||||
// Infra_Id: input.Infra_Id,
|
||||
}
|
||||
item, err := ui.CreateData(itemCreate, event, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
input.Item_Id = &item.Id
|
||||
return nil
|
||||
// data.CheckupCategory_Code = inputSrc.CheckupCategory_Code
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user