74 lines
1.7 KiB
Go
74 lines
1.7 KiB
Go
package deviceorderitem
|
|
|
|
import (
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
ed "simrs-vx/internal/domain/main-entities/device"
|
|
edo "simrs-vx/internal/domain/main-entities/device-order"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
DeviceOrder_Id *uint `json:"deviceOrder_id"`
|
|
Device_Code *string `json:"device_code"`
|
|
Quantity uint8 `json:"quantity"`
|
|
}
|
|
|
|
type ReadListDto struct {
|
|
FilterDto
|
|
Includes string `json:"includes"`
|
|
Sort string `json:"sort"`
|
|
Pagination ecore.Pagination
|
|
}
|
|
|
|
type FilterDto struct {
|
|
DeviceOrder_Id *uint `json:"device-order-id"`
|
|
Device_Code *string `json:"device-code"`
|
|
Quantity uint8 `json:"quantity"`
|
|
}
|
|
type ReadDetailDto struct {
|
|
Id uint16 `json:"id"`
|
|
}
|
|
|
|
type UpdateDto struct {
|
|
Id uint16 `json:"id"`
|
|
CreateDto
|
|
}
|
|
|
|
type DeleteDto struct {
|
|
Id uint16 `json:"id"`
|
|
}
|
|
|
|
type MetaDto struct {
|
|
PageNumber int `json:"page_number"`
|
|
PageSize int `json:"page_size"`
|
|
Count int `json:"count"`
|
|
}
|
|
|
|
type ResponseDto struct {
|
|
ecore.Main
|
|
DeviceOrder_Id *uint `json:"deviceOrder_id"`
|
|
DeviceOrder *edo.DeviceOrder `json:"deviceOrder,omitempty"`
|
|
Device_Code *string `json:"device_code"`
|
|
Device *ed.Device `json:"device,omitempty"`
|
|
Quantity uint8 `json:"quantity"`
|
|
}
|
|
|
|
func (d DeviceOrderItem) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
DeviceOrder_Id: d.DeviceOrder_Id,
|
|
DeviceOrder: d.DeviceOrder,
|
|
Device_Code: d.Device_Code,
|
|
Device: d.Device,
|
|
Quantity: d.Quantity,
|
|
}
|
|
resp.Main = d.Main
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []DeviceOrderItem) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|