feat/things-munaja: adjust DeviceOrder
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package base
|
||||
package deviceorderitem
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
@@ -10,5 +10,5 @@ type DeviceOrderItem struct {
|
||||
DeviceOrder_Id *uint `json:"deviceOrder_id"`
|
||||
Device_Code *string `json:"device_code"`
|
||||
Device *ed.Device `json:"device,omitempty" gorm:"foreignKey:Device_Code;references:Code"`
|
||||
Count uint8 `json:"count"`
|
||||
Quantity uint8 `json:"quantity"`
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
type CreateDto struct {
|
||||
DeviceOrder_Id *uint `json:"deviceOrder_id"`
|
||||
Device_Code *string `json:"device_code"`
|
||||
Count uint8 `json:"count"`
|
||||
Quantity uint8 `json:"quantity"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -19,9 +19,9 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
DeviceOrder_Id *uint `json:"deviceOrder-id"`
|
||||
DeviceOrder_Id *uint `json:"device-order-id"`
|
||||
Device_Code *string `json:"device-code"`
|
||||
Count uint8 `json:"count"`
|
||||
Quantity uint8 `json:"quantity"`
|
||||
}
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
@@ -48,7 +48,7 @@ type ResponseDto struct {
|
||||
DeviceOrder *edo.DeviceOrder `json:"deviceOrder,omitempty"`
|
||||
Device_Code *string `json:"device_code"`
|
||||
Device *ed.Device `json:"device,omitempty"`
|
||||
Count uint8 `json:"count"`
|
||||
Quantity uint8 `json:"quantity"`
|
||||
}
|
||||
|
||||
func (d DeviceOrderItem) ToResponse() ResponseDto {
|
||||
@@ -57,7 +57,7 @@ func (d DeviceOrderItem) ToResponse() ResponseDto {
|
||||
DeviceOrder: d.DeviceOrder,
|
||||
Device_Code: d.Device_Code,
|
||||
Device: d.Device,
|
||||
Count: d.Count,
|
||||
Quantity: d.Quantity,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package deviceorderitem
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
edo "simrs-vx/internal/domain/main-entities/device-order"
|
||||
eb "simrs-vx/internal/domain/main-entities/device-order-item/base"
|
||||
)
|
||||
|
||||
type DeviceOrderItem struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
eb.DeviceOrderItem
|
||||
DeviceOrder *edo.DeviceOrder `json:"deviceOrder,omitempty" gorm:"foreignKey:DeviceOrder_Id;references:Id"`
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
|
||||
// internal - domain - main-entities
|
||||
edoi "simrs-vx/internal/domain/main-entities/device-order-item/base"
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
)
|
||||
@@ -55,11 +56,12 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Encounter *ee.Encounter `json:"encounter,omitempty"`
|
||||
Doctor_Code *string `json:"doctor_code"`
|
||||
Doctor *ed.Doctor `json:"doctor,omitempty"`
|
||||
Status_Code erc.DataStatusCode `json:"status_code"`
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Encounter *ee.Encounter `json:"encounter,omitempty"`
|
||||
Doctor_Code *string `json:"doctor_code"`
|
||||
Doctor *ed.Doctor `json:"doctor,omitempty"`
|
||||
Status_Code erc.DataStatusCode `json:"status_code"`
|
||||
Items []edoi.DeviceOrderItem `json:"items"`
|
||||
}
|
||||
|
||||
func (d DeviceOrder) ToResponse() ResponseDto {
|
||||
@@ -69,6 +71,7 @@ func (d DeviceOrder) ToResponse() ResponseDto {
|
||||
Doctor_Code: d.Doctor_Code,
|
||||
Doctor: d.Doctor,
|
||||
Status_Code: d.Status_Code,
|
||||
Items: d.Items,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
package deviceorder
|
||||
|
||||
import (
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
edoi "simrs-vx/internal/domain/main-entities/device-order-item/base"
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
)
|
||||
|
||||
type DeviceOrder struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||
Doctor_Code *string `json:"doctor_code"`
|
||||
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
|
||||
Status_Code erc.DataStatusCode `json:"status_code"`
|
||||
Items []*edoi.DeviceOrderItem `json:"items" gorm:"foreignKey:DeviceOrder_Id;references:Id"`
|
||||
ecore.Main // adjust this according to the needs
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||
Doctor_Code *string `json:"doctor_code"`
|
||||
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
|
||||
Status_Code erc.DataStatusCode `json:"status_code"`
|
||||
Items []edoi.DeviceOrderItem `json:"items" gorm:"foreignKey:DeviceOrder_Id;references:Id"`
|
||||
}
|
||||
|
||||
func (d DeviceOrder) IsCompleted() bool {
|
||||
|
||||
@@ -19,5 +19,5 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.DeviceOrderItem) {
|
||||
|
||||
data.DeviceOrder_Id = inputSrc.DeviceOrder_Id
|
||||
data.Device_Code = inputSrc.Device_Code
|
||||
data.Count = inputSrc.Count
|
||||
data.Quantity = inputSrc.Quantity
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user