77 lines
1.7 KiB
Go
77 lines
1.7 KiB
Go
package practiceschedule
|
|
|
|
import (
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
erc "simrs-vx/internal/domain/references/common"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Doctor_Id *uint `json:"doctor_id"`
|
|
Unit_Code *string `json:"unit_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_Id *uint `json:"doctor-id"`
|
|
Unit_Code *string `json:"unit-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_Id *uint `json:"doctor_id"`
|
|
Unit_Code *string `json:"unit_code"`
|
|
Day_Code *erc.DayCode `json:"day_code"`
|
|
StartTime *string `json:"startTime"`
|
|
EndTime *string `json:"endTime"`
|
|
}
|
|
|
|
func (d PracticeSchedule) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
Doctor_Id: d.Doctor_Id,
|
|
Unit_Code: d.Unit_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
|
|
}
|