switch fk for personaddress

This commit is contained in:
dpurbosakti
2025-10-10 14:12:05 +07:00
parent 738ee5b517
commit a298f192d5
4 changed files with 65 additions and 49 deletions

No files matched your search

@@ -5,11 +5,11 @@ import (
)
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"`
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"`
}
type ReadListDto struct {
@@ -38,11 +38,11 @@ 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"`
Address string `json:"address"`
Rt string `json:"rt"`
Rw string `json:"rw"`
Village_Code *string `json:"village_code"`
}
func (d PersonAddress) ToResponse() ResponseDto {
@@ -14,7 +14,7 @@ type PersonAddress struct {
LocationType_Code erp.AddressLocationTypeCode `json:"locationType_code" gorm:"size:10"`
Rt string `json:"rt" gorm:"size:2"`
Rw string `json:"rw" gorm:"size:2"`
PostalRegion_Code string `json:"postalRegion_code" gorm:"size:6"`
PostalRegion_Code *string `json:"postalRegion_code" gorm:"size:6"`
PostalRegion *epr.PostalRegion `json:"postalRegion,omitempty" gorm:"foreignKey:PostalRegion_Code;references:Code"`
Village_Code string `json:"village_code" gorm:"size:10"`
Village_Code *string `json:"village_code" gorm:"size:10"`
}