69 lines
1.5 KiB
Go
69 lines
1.5 KiB
Go
package mcusrc
|
|
|
|
import (
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Code string `json:"code"`
|
|
Name string `json:"name"`
|
|
CheckupCategory_Code *string `json:"checkupCategory_code"`
|
|
}
|
|
|
|
type ReadListDto struct {
|
|
Code string `json:"code"`
|
|
Name string `json:"name"`
|
|
CheckupCategory_Code *string `json:"checkupCategory_code"`
|
|
|
|
Page int `json:"page"`
|
|
PageSize int `json:"page_size"`
|
|
NoPagination int `json:"no_pagination"`
|
|
}
|
|
|
|
type ReadDetailDto struct {
|
|
Id uint16 `json:"id"`
|
|
Code string `json:"code"`
|
|
Name string `json:"name"`
|
|
CheckupCategory_Code *string `json:"checkupCategory_code"`
|
|
}
|
|
|
|
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.SmallMain
|
|
Code string `json:"code"`
|
|
Name string `json:"name"`
|
|
CheckupCategory_Code *string `json:"checkupCategory_code"`
|
|
}
|
|
|
|
func (d McuSrc) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
Code: d.Code,
|
|
Name: d.Name,
|
|
CheckupCategory_Code: d.CheckupCategory_Code,
|
|
}
|
|
resp.SmallMain = d.SmallMain
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []McuSrc) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|