package person import ( ecore "simrs-vx/internal/domain/base-entities/core" ee "simrs-vx/internal/domain/main-entities/ethnic" epa "simrs-vx/internal/domain/main-entities/person-address" epc "simrs-vx/internal/domain/main-entities/person-contact" erp "simrs-vx/internal/domain/references/person" "time" ) type CreateDto struct { Name string `json:"name"` BirthDate *time.Time `json:"birthDate,omitempty"` BirthRegency_Code *string `json:"birthRegency_code"` Gender_Code *erp.GenderCode `json:"gender_code"` ResidentIdentityNumber *string `json:"residentIdentityNumber"` Religion_Code *erp.ReligionCode `json:"religion_code"` Education_Code *erp.EducationCode `json:"education_code"` Ocupation_Code *erp.OcupationCode `json:"occupation_code"` Ocupation_Name *string `json:"occupation_name"` Ethnic_Code *string `json:"ethnic_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"` Name string `json:"name"` BirthDate *time.Time `json:"birthDate,omitempty"` BirthRegency_Code *string `json:"birthRegency_code"` Gender_Code *erp.GenderCode `json:"gender_code"` ResidentIdentityNumber *string `json:"residentIdentityNumber"` Religion_Code *erp.ReligionCode `json:"religion_code"` Education_Code *erp.EducationCode `json:"education_code"` Ocupation_Code *erp.OcupationCode `json:"occupation_code"` Ocupation_Name *string `json:"occupation_name"` Ethnic_Code *string `json:"ethnic_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 Name string `json:"name"` BirthDate *time.Time `json:"birthDate,omitempty"` BirthRegency_Code *string `json:"birthRegency_code"` Gender_Code *erp.GenderCode `json:"gender_code"` ResidentIdentityNumber *string `json:"residentIdentityNumber"` Religion_Code *erp.ReligionCode `json:"religion_code"` Education_Code *erp.EducationCode `json:"education_code"` Ocupation_Code *erp.OcupationCode `json:"occupation_code"` Ocupation_Name *string `json:"occupation_name"` Ethnic_Code *string `json:"ethnic_code"` Ethnic *ee.Ethnic `json:"ethnic,omitempty"` Addresses *[]epa.PersonAddress `json:"addresses,omitempty"` Contacts *[]epc.PersonContact `json:"contacts,omitempty"` } func (d *Person) ToResponse() ResponseDto { resp := ResponseDto{ Name: d.Name, BirthDate: d.BirthDate, BirthRegency_Code: d.BirthRegency_Code, Gender_Code: d.Gender_Code, ResidentIdentityNumber: d.ResidentIdentityNumber, Religion_Code: d.Religion_Code, Education_Code: d.Education_Code, Ocupation_Code: d.Ocupation_Code, Ocupation_Name: d.Ocupation_Name, Ethnic_Code: d.Ethnic_Code, Ethnic: d.Ethnic, Addresses: d.Addresses, Contacts: d.Contacts, } resp.Main = d.Main return resp } func ToResponseList(data []Person) []ResponseDto { resp := make([]ResponseDto, len(data)) for i, u := range data { resp[i] = u.ToResponse() } return resp }