feat (patient): adjust read detail after postalcode renamed
This commit is contained in:
@@ -3,6 +3,7 @@ package personaddress
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
epr "simrs-vx/internal/domain/main-entities/postal-region"
|
||||
ev "simrs-vx/internal/domain/main-entities/village"
|
||||
|
||||
erp "simrs-vx/internal/domain/references/person"
|
||||
)
|
||||
@@ -51,6 +52,7 @@ type ResponseDto struct {
|
||||
PostalRegion_Code *string `json:"postalRegion_code"`
|
||||
PostalRegion *epr.PostalRegion `json:"postalRegion,omitempty"`
|
||||
Village_Code *string `json:"village_code"`
|
||||
Village *ev.Village `json:"village,omitempty"`
|
||||
}
|
||||
|
||||
func (d PersonAddress) ToResponse() ResponseDto {
|
||||
@@ -60,9 +62,10 @@ func (d PersonAddress) ToResponse() ResponseDto {
|
||||
Address: d.Address,
|
||||
Rt: d.Rt,
|
||||
Rw: d.Rw,
|
||||
Village_Code: d.Village_Code,
|
||||
PostalRegion_Code: d.PostalRegion_Code,
|
||||
PostalRegion: d.PostalRegion,
|
||||
Village_Code: d.Village_Code,
|
||||
Village: d.Village,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
|
||||
@@ -293,7 +293,7 @@ func SetRoutes() http.Handler {
|
||||
hc.RegCrud(r, "/v1/district", district.O)
|
||||
hc.RegCrud(r, "/v1/regency", regency.O)
|
||||
hc.RegCrud(r, "/v1/province", province.O)
|
||||
hc.RegCrud(r, "/v1/postal-code", postalregion.O)
|
||||
hc.RegCrud(r, "/v1/postal-region", postalregion.O)
|
||||
|
||||
/////
|
||||
return cmw.SetCors(handlerlogger.SetLog(r))
|
||||
|
||||
@@ -101,7 +101,7 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
||||
Preload("Person.Language").
|
||||
Preload("Person.Contacts").
|
||||
Preload("Person.Relatives.Village.District.Regency.Province").
|
||||
Preload("Person.Addresses").
|
||||
Preload("Person.Addresses.Village.District.Regency.Province").
|
||||
Preload("Person.Addresses.PostalRegion.Village.District.Regency.Province")
|
||||
|
||||
if err := tx.First(&data, input.Id).Error; err != nil {
|
||||
|
||||
@@ -18,6 +18,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.PersonAddress) {
|
||||
}
|
||||
|
||||
data.Person_Id = inputSrc.Person_Id
|
||||
data.LocationType_Code = inputSrc.LocationType_Code
|
||||
data.Address = inputSrc.Address
|
||||
data.Rt = inputSrc.Rt
|
||||
data.Rw = inputSrc.Rw
|
||||
|
||||
Reference in New Issue
Block a user