88 lines
2.3 KiB
Go
88 lines
2.3 KiB
Go
package nurse
|
|
|
|
import (
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
ee "simrs-vx/internal/domain/main-entities/employee"
|
|
ei "simrs-vx/internal/domain/main-entities/infra"
|
|
es "simrs-vx/internal/domain/main-entities/specialist"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Code *string `json:"code" validate:"maxLength=20"`
|
|
Employee_Id *uint `json:"employee_id"`
|
|
IHS_Number *string `json:"ihs_number" validate:"maxLength=20"`
|
|
Specialist_Code *string `json:"specialist_code"`
|
|
Infra_Code *string `json:"infra_code"`
|
|
}
|
|
|
|
type ReadListDto struct {
|
|
FilterDto
|
|
Includes string `json:"includes"`
|
|
Pagination ecore.Pagination
|
|
}
|
|
|
|
type FilterDto struct {
|
|
Code *string `json:"code"`
|
|
Employee_Id *uint `json:"employee-id"`
|
|
IHS_Number *string `json:"ihs-number"`
|
|
Specialist_Code *string `json:"specialist-code"`
|
|
Infra_Code *string `json:"infra-code"`
|
|
}
|
|
type ReadDetailDto struct {
|
|
Id *uint16 `json:"id"`
|
|
Code *string `json:"code"`
|
|
Employee_Id *uint `json:"employee_id"`
|
|
IHS_Number *string `json:"ihs_number"`
|
|
}
|
|
|
|
type UpdateDto struct {
|
|
Id *uint `json:"id"`
|
|
CreateDto
|
|
}
|
|
|
|
type DeleteDto struct {
|
|
Id *uint `json:"id"`
|
|
Code *string `json:"code"`
|
|
}
|
|
|
|
type MetaDto struct {
|
|
PageNumber int `json:"page_number"`
|
|
PageSize int `json:"page_size"`
|
|
Count int `json:"count"`
|
|
}
|
|
|
|
type ResponseDto struct {
|
|
ecore.Main
|
|
Code *string `json:"code"`
|
|
Employee_Id *uint `json:"employee_id"`
|
|
Employee *ee.Employee `json:"employee,omitempty"`
|
|
IHS_Number *string `json:"ihs_number"`
|
|
Specialist_Code *string `json:"specialist_code"`
|
|
Specialist *es.Specialist `json:"specialist,omitempty"`
|
|
Infra_Code *string `json:"infra_code"`
|
|
Infra *ei.Infra `json:"infra,omitempty"`
|
|
}
|
|
|
|
func (d Nurse) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
Code: d.Code,
|
|
Employee_Id: d.Employee_Id,
|
|
Employee: d.Employee,
|
|
IHS_Number: d.IHS_Number,
|
|
Specialist_Code: d.Specialist_Code,
|
|
Specialist: d.Specialist,
|
|
Infra_Code: d.Infra_Code,
|
|
Infra: d.Infra,
|
|
}
|
|
resp.Main = d.Main
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []Nurse) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|