From 7966cd11e139116f6f903ce88f6fd9b7c52cd51d Mon Sep 17 00:00:00 2001 From: dpurbosakti Date: Mon, 6 Oct 2025 11:57:31 +0700 Subject: [PATCH 1/2] add coms, and disabillty column into person --- .../migrations/20251006045658.sql | 2 + cmd/main-migration/migrations/atlas.sum | 5 +- .../domain/main-entities/person/entity.go | 54 ++++++++++--------- 3 files changed, 33 insertions(+), 28 deletions(-) create mode 100644 cmd/main-migration/migrations/20251006045658.sql diff --git a/cmd/main-migration/migrations/20251006045658.sql b/cmd/main-migration/migrations/20251006045658.sql new file mode 100644 index 00000000..a8c3a4d7 --- /dev/null +++ b/cmd/main-migration/migrations/20251006045658.sql @@ -0,0 +1,2 @@ +-- Modify "Person" table +ALTER TABLE "public"."Person" ADD COLUMN "CommunicationIssueStatus" boolean NULL, ADD COLUMN "Disabillity" character varying(100) NULL; diff --git a/cmd/main-migration/migrations/atlas.sum b/cmd/main-migration/migrations/atlas.sum index de8766a9..e6f4c0ca 100644 --- a/cmd/main-migration/migrations/atlas.sum +++ b/cmd/main-migration/migrations/atlas.sum @@ -1,4 +1,4 @@ -h1:cZd+VVhnt5FF4se9KNDa0hoFlY3AMn3nN7apKGwyPf4= +h1:JsKC89Hpwk3JTQjwLwPRlSPOwsFDWgb5NZ1roR6HyL4= 20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k= 20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0= 20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI= @@ -24,4 +24,5 @@ h1:cZd+VVhnt5FF4se9KNDa0hoFlY3AMn3nN7apKGwyPf4= 20251002085604.sql h1:3xZ68eYp4urXRnvotNH1XvG2mYOSDV/j3zHEZ/txg5E= 20251003032030.sql h1:HB+mQ2lXMNomHDpaRhB/9IwYI9/YiDO5eOJ+nAQH/jw= 20251005060450.sql h1:LbtCE2b+8osM3CvnmQJH1uCPtn+d7WchsslBOz8bL3Q= -20251006041122.sql h1:XQh6G6ZbkpiKXpMy6xe1pJRD+vvyQ1IEw+1JOIRU7Cg= +20251006041122.sql h1:MlS7f21z06sutnf9dIekt5fuHJr4lgcQ4uCuCXAGsfc= +20251006045658.sql h1:Frqb7wni/OVZT3jVYOE4ff/3MmWccWJJj4yMxvWUHbs= diff --git a/internal/domain/main-entities/person/entity.go b/internal/domain/main-entities/person/entity.go index 0f12fcd3..569a73c4 100644 --- a/internal/domain/main-entities/person/entity.go +++ b/internal/domain/main-entities/person/entity.go @@ -13,32 +13,34 @@ import ( ) type Person struct { - ecore.Main // adjust this according to the needs - Name string `json:"name" gorm:"not null;size:150"` - FrontTitle *string `json:"frontTitle" gorm:"size:50"` - EndTitle *string `json:"endTitle" gorm:"size:50"` - BirthDate *time.Time `json:"birthDate,omitempty"` - BirthRegency_Code *string `json:"birthRegency_code" gorm:"size:4"` - Gender_Code *erp.GenderCode `json:"gender_code" gorm:"size:10"` - ResidentIdentityNumber *string `json:"residentIdentityNumber" gorm:"unique;size:16"` - PassportNumber *string `json:"passportNumber" gorm:"unique;size:20"` - DrivingLicenseNumber *string `json:"drivingLicenseNumber" gorm:"unique;size:20"` - Religion_Code *erp.ReligionCode `json:"religion_code" gorm:"size:10"` - Education_Code *erp.EducationCode `json:"education_code" gorm:"size:10"` - Ocupation_Code *erp.OcupationCode `json:"occupation_code" gorm:"size:15"` - Ocupation_Name *string `json:"occupation_name" gorm:"size:50"` - Nationality *string `json:"nationality": gorm:"size:50"` - Ethnic_Code *string `json:"ethnic_code" gorm:"size:20"` - Ethnic *ee.Ethnic `json:"ethnic,omitempty" gorm:"foreignKey:Ethnic_Code;references:Code"` - Addresses *[]epa.PersonAddress `json:"addresses" gorm:"foreignKey:Person_Id"` - Contacts *[]epc.PersonContact `json:"contacts" gorm:"foreignKey:Person_Id"` - Relatives *[]epr.PersonRelative `json:"relatives" gorm:"foreignKey:Person_Id"` - Language_Code *string `json:"language_code" gorm:"size:10"` - Language *el.Language `json:"language,omitempty" gorm:"foreignKey:Language_Code;references:Code"` - ResidentIdentityFileUrl *string `json:"residentIdentityFileUrl" gorm:"size:1024"` - PassportFileUrl *string `json:"passportFileUrl" gorm:"size:1024"` - DrivingLicenseFileUrl *string `json:"drivingLicenseFileUrl" gorm:"size:1024"` - FamilyIdentityFileUrl *string `json:"familyIdentityFileUrl" gorm:"size:1024"` + ecore.Main // adjust this according to the needs + Name string `json:"name" gorm:"not null;size:150"` + FrontTitle *string `json:"frontTitle" gorm:"size:50"` + EndTitle *string `json:"endTitle" gorm:"size:50"` + BirthDate *time.Time `json:"birthDate,omitempty"` + BirthRegency_Code *string `json:"birthRegency_code" gorm:"size:4"` + Gender_Code *erp.GenderCode `json:"gender_code" gorm:"size:10"` + ResidentIdentityNumber *string `json:"residentIdentityNumber" gorm:"unique;size:16"` + PassportNumber *string `json:"passportNumber" gorm:"unique;size:20"` + DrivingLicenseNumber *string `json:"drivingLicenseNumber" gorm:"unique;size:20"` + Religion_Code *erp.ReligionCode `json:"religion_code" gorm:"size:10"` + Education_Code *erp.EducationCode `json:"education_code" gorm:"size:10"` + Ocupation_Code *erp.OcupationCode `json:"occupation_code" gorm:"size:15"` + Ocupation_Name *string `json:"occupation_name" gorm:"size:50"` + Nationality *string `json:"nationality": gorm:"size:50"` + Ethnic_Code *string `json:"ethnic_code" gorm:"size:20"` + Ethnic *ee.Ethnic `json:"ethnic,omitempty" gorm:"foreignKey:Ethnic_Code;references:Code"` + Addresses *[]epa.PersonAddress `json:"addresses" gorm:"foreignKey:Person_Id"` + Contacts *[]epc.PersonContact `json:"contacts" gorm:"foreignKey:Person_Id"` + Relatives *[]epr.PersonRelative `json:"relatives" gorm:"foreignKey:Person_Id"` + Language_Code *string `json:"language_code" gorm:"size:10"` + Language *el.Language `json:"language,omitempty" gorm:"foreignKey:Language_Code;references:Code"` + CommunicationIssueStatus bool `json:"communicationIssueStatus"` + Disabillity *string `json:"disabillity" gorm:"size:100"` + ResidentIdentityFileUrl *string `json:"residentIdentityFileUrl" gorm:"size:1024"` + PassportFileUrl *string `json:"passportFileUrl" gorm:"size:1024"` + DrivingLicenseFileUrl *string `json:"drivingLicenseFileUrl" gorm:"size:1024"` + FamilyIdentityFileUrl *string `json:"familyIdentityFileUrl" gorm:"size:1024"` } func (d Person) IsSameResidentIdentityNumber(input *string) bool { From cb7eac26ef5fd853a8b9fd8f065832705817c56d Mon Sep 17 00:00:00 2001 From: dpurbosakti Date: Mon, 6 Oct 2025 11:59:50 +0700 Subject: [PATCH 2/2] fix disability column typo --- cmd/main-migration/migrations/20251006045928.sql | 2 ++ cmd/main-migration/migrations/atlas.sum | 5 +++-- internal/domain/main-entities/person/entity.go | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 cmd/main-migration/migrations/20251006045928.sql diff --git a/cmd/main-migration/migrations/20251006045928.sql b/cmd/main-migration/migrations/20251006045928.sql new file mode 100644 index 00000000..f495a26d --- /dev/null +++ b/cmd/main-migration/migrations/20251006045928.sql @@ -0,0 +1,2 @@ +-- Rename a column from "Disabillity" to "Disability" +ALTER TABLE "public"."Person" RENAME COLUMN "Disabillity" TO "Disability"; diff --git a/cmd/main-migration/migrations/atlas.sum b/cmd/main-migration/migrations/atlas.sum index e6f4c0ca..e900c72e 100644 --- a/cmd/main-migration/migrations/atlas.sum +++ b/cmd/main-migration/migrations/atlas.sum @@ -1,4 +1,4 @@ -h1:JsKC89Hpwk3JTQjwLwPRlSPOwsFDWgb5NZ1roR6HyL4= +h1:mTtZwYftlpTk+eVzzPqjg+OMUYcQGa39qB5fLUehDC8= 20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k= 20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0= 20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI= @@ -25,4 +25,5 @@ h1:JsKC89Hpwk3JTQjwLwPRlSPOwsFDWgb5NZ1roR6HyL4= 20251003032030.sql h1:HB+mQ2lXMNomHDpaRhB/9IwYI9/YiDO5eOJ+nAQH/jw= 20251005060450.sql h1:LbtCE2b+8osM3CvnmQJH1uCPtn+d7WchsslBOz8bL3Q= 20251006041122.sql h1:MlS7f21z06sutnf9dIekt5fuHJr4lgcQ4uCuCXAGsfc= -20251006045658.sql h1:Frqb7wni/OVZT3jVYOE4ff/3MmWccWJJj4yMxvWUHbs= +20251006045658.sql h1:3FmGCPCzjgMPdWDRodZTsx3KVaodd9zB9ilib69aewk= +20251006045928.sql h1:bIdFndhaIdxtwEJr9aNirQTZ2bFGg9KK5PYhN8dDyUs= diff --git a/internal/domain/main-entities/person/entity.go b/internal/domain/main-entities/person/entity.go index 569a73c4..91b2462e 100644 --- a/internal/domain/main-entities/person/entity.go +++ b/internal/domain/main-entities/person/entity.go @@ -36,7 +36,7 @@ type Person struct { Language_Code *string `json:"language_code" gorm:"size:10"` Language *el.Language `json:"language,omitempty" gorm:"foreignKey:Language_Code;references:Code"` CommunicationIssueStatus bool `json:"communicationIssueStatus"` - Disabillity *string `json:"disabillity" gorm:"size:100"` + Disability *string `json:"disability" gorm:"size:100"` ResidentIdentityFileUrl *string `json:"residentIdentityFileUrl" gorm:"size:1024"` PassportFileUrl *string `json:"passportFileUrl" gorm:"size:1024"` DrivingLicenseFileUrl *string `json:"drivingLicenseFileUrl" gorm:"size:1024"`