This commit is contained in:
dpurbosakti
2025-10-10 14:26:15 +07:00
parent ace549b418
commit dc0b492951
12 changed files with 70 additions and 61 deletions

No files matched your search

@@ -2,14 +2,19 @@ package personaddress
import (
ecore "simrs-vx/internal/domain/base-entities/core"
epr "simrs-vx/internal/domain/main-entities/postal-region"
erp "simrs-vx/internal/domain/references/person"
)
type CreateDto struct {
Person_Id uint `json:"person_id"`
Address string `json:"address" validate:"maxLength=150"`
Rt string `json:"rt" validate:"maxLength=2"`
Rw string `json:"rw" validate:"maxLength=2"`
Village_Code *string `json:"village_code" validate:"maxLength=10"`
Person_Id uint `json:"person_id"`
LocationType_Code erp.AddressLocationTypeCode `json:"locationType_code" validate:"maxLength=10"`
Address string `json:"address" validate:"maxLength=150"`
Rt string `json:"rt" validate:"maxLength=2"`
Rw string `json:"rw" validate:"maxLength=2"`
PostalRegion_Code *string `json:"postalRegion_code" validate:"maxLength=6"`
Village_Code *string `json:"village_code" validate:"maxLength=10"`
}
type ReadListDto struct {
@@ -38,22 +43,26 @@ type MetaDto struct {
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"`
Person_Id uint `json:"person_id"`
LocationType_Code erp.AddressLocationTypeCode `json:"locationType_code"`
Address string `json:"address"`
Rt string `json:"rt"`
Rw string `json:"rw"`
PostalRegion_Code *string `json:"postalRegion_code"`
PostalRegion *epr.PostalRegion `json:"postalRegion,omitempty"`
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,
PostalCode_Code: d.PostalCode_Code,
PostalCode: d.PostalCode,
Person_Id: d.Person_Id,
LocationType_Code: d.LocationType_Code,
Address: d.Address,
Rt: d.Rt,
Rw: d.Rw,
Village_Code: d.Village_Code,
PostalRegion_Code: d.PostalRegion_Code,
PostalRegion: d.PostalRegion,
}
resp.Main = d.Main
return resp
@@ -7,5 +7,5 @@ type Basic struct {
}
func (Basic) TableName() string {
return "PostalCode"
return "PostalRegion"
}