73 lines
1.5 KiB
Go
73 lines
1.5 KiB
Go
package personaddress
|
|
|
|
import (
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
Person_Id uint `json:"person_id"`
|
|
Address string `json:"address"`
|
|
Rt string `json:"rt"`
|
|
Rw string `json:"rw"`
|
|
Village_Code string `json:"village_code"`
|
|
}
|
|
|
|
type ReadListDto struct {
|
|
Page int `json:"page"`
|
|
PageSize int `json:"page_size"`
|
|
NoPagination int `json:"no_pagination"`
|
|
}
|
|
|
|
type ReadDetailDto struct {
|
|
Id uint `json:"id"`
|
|
Person_Id uint `json:"person_id"`
|
|
Address string `json:"address"`
|
|
Rt string `json:"rt"`
|
|
Rw string `json:"rw"`
|
|
Village_Code string `json:"village_code"`
|
|
}
|
|
|
|
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"`
|
|
Address string `json:"address"`
|
|
Rt string `json:"rt"`
|
|
Rw string `json:"rw"`
|
|
Village_Code string `json:"village_code"`
|
|
}
|
|
|
|
func (d PersonAddress) ToResponse() ResponseDto {
|
|
resp := ResponseDto{
|
|
Person_Id: d.Person_Id,
|
|
Address: d.Address,
|
|
Rt: d.Rt,
|
|
Rw: d.Rw,
|
|
Village_Code: d.Village_Code,
|
|
}
|
|
resp.Main = d.Main
|
|
return resp
|
|
}
|
|
|
|
func ToResponseList(data []PersonAddress) []ResponseDto {
|
|
resp := make([]ResponseDto, len(data))
|
|
for i, u := range data {
|
|
resp[i] = u.ToResponse()
|
|
}
|
|
return resp
|
|
}
|