Files
simrsx-be/internal/domain/main-entities/practice-schedule/dto.go
T

77 lines
1.8 KiB
Go

package practiceschedule
import (
ecore "simrs-vx/internal/domain/base-entities/core"
erc "simrs-vx/internal/domain/references/common"
)
type CreateDto struct {
Doctor_Code *string `json:"doctor_code"`
Specialist_Code *string `json:"specialist_code"`
Day_Code *erc.DayCode `json:"day_code"`
StartTime *string `json:"startTime" validate:"maxLength=5"`
EndTime *string `json:"endTime" validate:"maxLength=5"`
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Pagination ecore.Pagination
}
type FilterDto struct {
Doctor_Code *string `json:"doctor-code"`
Specialist_Code *string `json:"specialist-code"`
Day_Code *erc.DayCode `json:"day-code"`
StartTime *string `json:"startTime"`
EndTime *string `json:"endTime"`
}
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
Doctor_Code *string `json:"doctor_code"`
Specialist_Code *string `json:"specialist_code"`
Day_Code *erc.DayCode `json:"day_code"`
StartTime *string `json:"startTime"`
EndTime *string `json:"endTime"`
}
func (d PracticeSchedule) ToResponse() ResponseDto {
resp := ResponseDto{
Doctor_Code: d.Doctor_Code,
Specialist_Code: d.Specialist_Code,
Day_Code: d.Day_Code,
StartTime: d.StartTime,
EndTime: d.EndTime,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []PracticeSchedule) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}