Files
simrsx-be/internal/domain/main-entities/practice-schedule/dto.go
T
2025-08-27 13:46:04 +07:00

80 lines
1.9 KiB
Go

package practiceschedule
import (
ecore "simrs-vx/internal/domain/base-entities/core"
erx "simrs-vx/internal/domain/references/xtime"
)
type CreateDto struct {
Doctor_Id *uint `json:"doctor_id"`
Unit_Code *string `json:"unit_code"`
Day_Code *erx.DayCode `json:"day_code"`
StartTime *string `json:"startTime"`
EndTime *string `json:"endTime"`
}
type ReadListDto struct {
Doctor_Id *uint `json:"doctor_id"`
Unit_Code *string `json:"unit_code"`
Day_Code *erx.DayCode `json:"day_code"`
StartTime *string `json:"startTime"`
EndTime *string `json:"endTime"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Doctor_Id *uint `json:"doctor_id"`
Unit_Code *string `json:"unit_code"`
Day_Code *erx.DayCode `json:"day_code"`
StartTime *string `json:"startTime"`
EndTime *string `json:"endTime"`
}
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 *erx.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
}