feat (person): add coms issue and disability field

This commit is contained in:
dpurbosakti
2025-10-06 12:03:25 +07:00
parent 4ce3b566a2
commit ec7cd9b929
2 changed files with 90 additions and 80 deletions
+88 -80
View File
@@ -13,22 +13,24 @@ import (
)
type CreateDto struct {
Name string `json:"name" validate:"maxLength=150"`
FrontTitle *string `json:"frontTitle" validate:"maxLength=50"`
EndTitle *string `json:"endTitle" validate:"maxLength=50"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency_code" validate:"maxLength=4"`
Gender_Code *erp.GenderCode `json:"gender_code"`
ResidentIdentityNumber *string `json:"residentIdentityNumber" validate:"nik;maxLength=16"`
PassportNumber *string `json:"passportNumber" validate:"maxLength=20"`
DrivingLicenseNumber *string `json:"drivingLicenseNumber" validate:"maxLength=20"`
Religion_Code *erp.ReligionCode `json:"religion_code" validate:"maxLength=10"`
Education_Code *erp.EducationCode `json:"education_code" validate:"maxLength=10"`
Ocupation_Code *erp.OcupationCode `json:"occupation_code" validate:"maxLength=15"`
Ocupation_Name *string `json:"occupation_name" validate:"maxLength=50"`
Nationality *string `json:"nationality" validate:"maxLength=50"`
Ethnic_Code *string `json:"ethnic_code" validate:"maxLength=20"`
Language_Code *string `json:"language_code" validate:"maxLength=10"`
Name string `json:"name" validate:"maxLength=150"`
FrontTitle *string `json:"frontTitle" validate:"maxLength=50"`
EndTitle *string `json:"endTitle" validate:"maxLength=50"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency_code" validate:"maxLength=4"`
Gender_Code *erp.GenderCode `json:"gender_code"`
ResidentIdentityNumber *string `json:"residentIdentityNumber" validate:"nik;maxLength=16"`
PassportNumber *string `json:"passportNumber" validate:"maxLength=20"`
DrivingLicenseNumber *string `json:"drivingLicenseNumber" validate:"maxLength=20"`
Religion_Code *erp.ReligionCode `json:"religion_code" validate:"maxLength=10"`
Education_Code *erp.EducationCode `json:"education_code" validate:"maxLength=10"`
Ocupation_Code *erp.OcupationCode `json:"occupation_code" validate:"maxLength=15"`
Ocupation_Name *string `json:"occupation_name" validate:"maxLength=50"`
Nationality *string `json:"nationality" validate:"maxLength=50"`
Ethnic_Code *string `json:"ethnic_code" validate:"maxLength=20"`
Language_Code *string `json:"language_code" validate:"maxLength=10"`
CommunicationIssueStatus bool `json:"communicationIssueStatus"`
Disability *string `json:"disability" validate:"maxLength=100"`
}
type ReadListDto struct {
@@ -39,22 +41,24 @@ type ReadListDto struct {
}
type FilterDto struct {
Name string `json:"name"`
FrontTitle *string `json:"frontTitle"`
EndTitle *string `json:"endTitle"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency-code"`
Gender_Code *erp.GenderCode `json:"gender-code"`
ResidentIdentityNumber *string `json:"residentIdentityNumber"`
PassportNumber *string `json:"passportNumber"`
DrivingLicenseNumber *string `json:"drivingLicenseNumber"`
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"`
Nationality *string `json:"nationality"`
Ethnic_Code *string `json:"ethnic-code"`
Language_Code *string `json:"language-code"`
Name string `json:"name"`
FrontTitle *string `json:"frontTitle"`
EndTitle *string `json:"endTitle"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency-code"`
Gender_Code *erp.GenderCode `json:"gender-code"`
ResidentIdentityNumber *string `json:"residentIdentityNumber"`
PassportNumber *string `json:"passportNumber"`
DrivingLicenseNumber *string `json:"drivingLicenseNumber"`
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"`
Nationality *string `json:"nationality"`
Ethnic_Code *string `json:"ethnic-code"`
Language_Code *string `json:"language-code"`
CommunicationIssueStatus bool `json:"communicationIssueStatus"`
Disability *string `json:"disability"`
}
type ReadDetailDto struct {
@@ -82,58 +86,62 @@ type MetaDto struct {
type ResponseDto struct {
ecore.Main
Name string `json:"name"`
FrontTitle *string `json:"frontTitle"`
EndTitle *string `json:"endTitle"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency_code"`
Gender_Code *erp.GenderCode `json:"gender_code"`
ResidentIdentityNumber *string `json:"residentIdentityNumber"`
PassportNumber *string `json:"passportNumber"`
DrivingLicenseNumber *string `json:"drivingLicenseNumber"`
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"`
Nationality *string `json:"nationality"`
Ethnic_Code *string `json:"ethnic_code"`
Ethnic *ee.Ethnic `json:"ethnic,omitempty"`
Addresses *[]epa.PersonAddress `json:"addresses,omitempty"`
Contacts *[]epc.PersonContact `json:"contacts,omitempty"`
Relatives *[]epr.PersonRelative `json:"relatives,omitempty"`
Language_Code *string `json:"language_code"`
ResidentIdentityFileUrl *string `json:"residentIdentityFileUrl"`
PassportFileUrl *string `json:"passportFileUrl"`
DrivingLicenseFileUrl *string `json:"drivingLicenseFileUrl"`
FamilyIdentityFileUrl *string `json:"familyIdentityFileUrl"`
Name string `json:"name"`
FrontTitle *string `json:"frontTitle"`
EndTitle *string `json:"endTitle"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency_code"`
Gender_Code *erp.GenderCode `json:"gender_code"`
ResidentIdentityNumber *string `json:"residentIdentityNumber"`
PassportNumber *string `json:"passportNumber"`
DrivingLicenseNumber *string `json:"drivingLicenseNumber"`
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"`
Nationality *string `json:"nationality"`
Ethnic_Code *string `json:"ethnic_code"`
Ethnic *ee.Ethnic `json:"ethnic,omitempty"`
Addresses *[]epa.PersonAddress `json:"addresses,omitempty"`
Contacts *[]epc.PersonContact `json:"contacts,omitempty"`
Relatives *[]epr.PersonRelative `json:"relatives,omitempty"`
Language_Code *string `json:"language_code"`
CommunicationIssueStatus bool `json:"communicationIssueStatus"`
Disability *string `json:"disability"`
ResidentIdentityFileUrl *string `json:"residentIdentityFileUrl"`
PassportFileUrl *string `json:"passportFileUrl"`
DrivingLicenseFileUrl *string `json:"drivingLicenseFileUrl"`
FamilyIdentityFileUrl *string `json:"familyIdentityFileUrl"`
}
func (d *Person) ToResponse() ResponseDto {
resp := ResponseDto{
Name: d.Name,
FrontTitle: d.FrontTitle,
EndTitle: d.EndTitle,
BirthDate: d.BirthDate,
BirthRegency_Code: d.BirthRegency_Code,
Gender_Code: d.Gender_Code,
ResidentIdentityNumber: d.ResidentIdentityNumber,
PassportNumber: d.PassportNumber,
DrivingLicenseNumber: d.DrivingLicenseNumber,
Religion_Code: d.Religion_Code,
Education_Code: d.Education_Code,
Ocupation_Code: d.Ocupation_Code,
Ocupation_Name: d.Ocupation_Name,
Nationality: d.Nationality,
Ethnic_Code: d.Ethnic_Code,
Ethnic: d.Ethnic,
Addresses: d.Addresses,
Contacts: d.Contacts,
Relatives: d.Relatives,
Language_Code: d.Language_Code,
ResidentIdentityFileUrl: d.ResidentIdentityFileUrl,
PassportFileUrl: d.PassportFileUrl,
DrivingLicenseFileUrl: d.DrivingLicenseFileUrl,
FamilyIdentityFileUrl: d.FamilyIdentityFileUrl,
Name: d.Name,
FrontTitle: d.FrontTitle,
EndTitle: d.EndTitle,
BirthDate: d.BirthDate,
BirthRegency_Code: d.BirthRegency_Code,
Gender_Code: d.Gender_Code,
ResidentIdentityNumber: d.ResidentIdentityNumber,
PassportNumber: d.PassportNumber,
DrivingLicenseNumber: d.DrivingLicenseNumber,
Religion_Code: d.Religion_Code,
Education_Code: d.Education_Code,
Ocupation_Code: d.Ocupation_Code,
Ocupation_Name: d.Ocupation_Name,
Nationality: d.Nationality,
Ethnic_Code: d.Ethnic_Code,
Ethnic: d.Ethnic,
Addresses: d.Addresses,
Contacts: d.Contacts,
Relatives: d.Relatives,
Language_Code: d.Language_Code,
CommunicationIssueStatus: d.CommunicationIssueStatus,
Disability: d.Disability,
ResidentIdentityFileUrl: d.ResidentIdentityFileUrl,
PassportFileUrl: d.PassportFileUrl,
DrivingLicenseFileUrl: d.DrivingLicenseFileUrl,
FamilyIdentityFileUrl: d.FamilyIdentityFileUrl,
}
resp.Main = d.Main
return resp
@@ -33,4 +33,6 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Person) {
data.Nationality = inputSrc.Nationality
data.Ethnic_Code = inputSrc.Ethnic_Code
data.Language_Code = inputSrc.Language_Code
data.CommunicationIssueStatus = inputSrc.CommunicationIssueStatus
data.Disability = inputSrc.Disability
}