84 lines
2.2 KiB
Go
84 lines
2.2 KiB
Go
package room
|
|
|
|
import (
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
ei "simrs-vx/internal/domain/main-entities/infra"
|
|
es "simrs-vx/internal/domain/main-entities/specialist"
|
|
ess "simrs-vx/internal/domain/main-entities/subspecialist"
|
|
eu "simrs-vx/internal/domain/main-entities/unit"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Infra_Id *uint16 `json:"infra_id"`
|
|
Unit_Id *uint16 `json:"unit_id"`
|
|
Specialist_Id *uint16 `json:"specialist_id"`
|
|
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
|
}
|
|
|
|
type ReadListDto struct {
|
|
FilterDto
|
|
Includes string `json:"includes"`
|
|
Pagination ecore.Pagination
|
|
}
|
|
|
|
type FilterDto struct {
|
|
Infra_Id *uint16 `json:"infra-id"`
|
|
Unit_Id *uint16 `json:"unit-id"`
|
|
Specialist_Id *uint16 `json:"specialist-id"`
|
|
Subspecialist_Id *uint16 `json:"subspecialist-id"`
|
|
}
|
|
|
|
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.SmallMain
|
|
Infra_Id *uint16 `json:"infra_id"`
|
|
Infra *ei.Infra `json:"infra,omitempty"`
|
|
Unit_Id *uint16 `json:"unit_id"`
|
|
Unit *eu.Unit `json:"unit,omitempty"`
|
|
Specialist_Id *uint16 `json:"specialist_id"`
|
|
Specialist *es.Specialist `json:"specialist,omitempty"`
|
|
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
|
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"`
|
|
}
|
|
|
|
func (d Room) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
Infra_Id: d.Infra_Id,
|
|
Infra: d.Infra,
|
|
Unit_Id: d.Unit_Id,
|
|
Unit: d.Unit,
|
|
Specialist_Id: d.Specialist_Id,
|
|
Specialist: d.Specialist,
|
|
Subspecialist_Id: d.Subspecialist_Id,
|
|
Subspecialist: d.Subspecialist,
|
|
}
|
|
resp.SmallMain = d.SmallMain
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []Room) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|