3d165447f5
+ added intern + updated employee + updated user
82 lines
2.0 KiB
Go
82 lines
2.0 KiB
Go
package intern
|
|
|
|
import (
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
ep "simrs-vx/internal/domain/main-entities/person"
|
|
es "simrs-vx/internal/domain/main-entities/specialist"
|
|
ess "simrs-vx/internal/domain/main-entities/subspecialist"
|
|
eu "simrs-vx/internal/domain/main-entities/user"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Person_Id *uint `json:"person_id"`
|
|
Specialist_Id *uint16 `json:"specialist_id"`
|
|
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
|
User_Id *uint `json:"user_id"`
|
|
}
|
|
|
|
type ReadListDto struct {
|
|
FilterDto
|
|
Includes string `json:"includes"`
|
|
Preloads []string `json:"-"`
|
|
Pagination ecore.Pagination
|
|
}
|
|
|
|
type FilterDto struct {
|
|
Person_Id *uint `json:"person_id"`
|
|
Specialist_Id *uint16 `json:"specialist_id"`
|
|
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
|
User_Id *uint `json:"user_id"`
|
|
}
|
|
|
|
type ReadDetailDto struct {
|
|
Id uint16 `json:"id"`
|
|
User_Id *uint `json:"user_id"`
|
|
}
|
|
|
|
type UpdateDto struct {
|
|
Id uint `json:"id"`
|
|
CreateDto
|
|
}
|
|
|
|
type DeleteDto struct {
|
|
Id uint `json:"id"`
|
|
}
|
|
|
|
type MetaDto struct {
|
|
PageNumber int `json:"page_number"`
|
|
PageSize int `json:"page_size"`
|
|
Count int `json:"count"`
|
|
}
|
|
|
|
type ResponseDto struct {
|
|
ecore.Main
|
|
Person_Id *uint `json:"person_id"`
|
|
Person *ep.Person `json:"person,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"`
|
|
User_Id *uint `json:"user_id"`
|
|
User *eu.User `json:"user,omitempty"`
|
|
}
|
|
|
|
func (d Intern) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
Person_Id: d.Person_Id,
|
|
Person: d.Person,
|
|
User_Id: d.User_Id,
|
|
User: d.User,
|
|
}
|
|
resp.Main = d.Main
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []Intern) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|