diff --git a/cmd/migration/migrations/20250904050121.sql b/cmd/migration/migrations/20250904050121.sql new file mode 100644 index 00000000..40202be4 --- /dev/null +++ b/cmd/migration/migrations/20250904050121.sql @@ -0,0 +1,2 @@ +-- Modify "Laborant" table +ALTER TABLE "public"."Laborant" ALTER COLUMN "Id" TYPE bigint, DROP COLUMN "Code", DROP COLUMN "Name", DROP COLUMN "Parent_Id", ADD COLUMN "Employee_Id" bigint NULL, ADD COLUMN "IHS_Number" character varying(20) NULL, ADD CONSTRAINT "fk_Laborant_Employee" FOREIGN KEY ("Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION; diff --git a/cmd/migration/migrations/atlas.sum b/cmd/migration/migrations/atlas.sum index bd1fd480..97320192 100644 --- a/cmd/migration/migrations/atlas.sum +++ b/cmd/migration/migrations/atlas.sum @@ -1,4 +1,4 @@ -h1:SEKp4pTgTBf9j9WlbMblM56D9bo7EgXZbCgN5aCmycE= +h1:6MHXV9+frKLPEcCO0gFFKAXHpOQ9N2XozZ+BKsjEyPk= 20250829081952.sql h1:YMsYq3uPsx70EjWSGfYnVRR5GV0q1fRGIszYZAWzXNo= 20250901073356.sql h1:jjd5TLs+Pyi0u3SrOM+aNTbHxSJboXgcOz/L4bkYx+c= 20250901080035.sql h1:LWa3X0NWjalVcxNbk5HaHj1Oqu60/AQabi0jBmCeQBI= @@ -8,5 +8,6 @@ h1:SEKp4pTgTBf9j9WlbMblM56D9bo7EgXZbCgN5aCmycE= 20250902105300.sql h1:6N2SDYK3a6djaO6u468E/DrDR9kM+uYoJvNlTFon6bY= 20250903041718.sql h1:ZiaacurDuBwWaI348Sjo7VZ6rSsj9TLTkudiRv05C/w= 20250903073200.sql h1:4i/3uJdYiAuKZ6upRK+xXUHBN7xHSK8G5QjaDkQt8E8= -20250904045113.sql h1:Ak/LiCz/prpIBkufkJkJIrx1/MJUdrryAAhoF2d+6Zg= -20250904045250.sql h1:UhHhYtF1CdKa29LuYb8ZNduVmXQEg9tu0pY0aHe/Njg= +20250904045113.sql h1:/LPs3tJWaQgK2HHdFHjSE/65GQ17rXgQ9NhTlgCiDVo= +20250904045250.sql h1:drbQ0H80dgxnQ26AMfPBwV8wwAOuzSBnoodHwdwV7cI= +20250904050121.sql h1:5AcfudjmiD3Z7wtRcw8i74ryUsMsMfcssnk0CyABvAE= diff --git a/internal/domain/main-entities/laborant/dto.go b/internal/domain/main-entities/laborant/dto.go index 47860e7c..31df3a9e 100644 --- a/internal/domain/main-entities/laborant/dto.go +++ b/internal/domain/main-entities/laborant/dto.go @@ -51,11 +51,11 @@ type ResponseDto struct { func (d Laborant) ToResponse() ResponseDto { resp := ResponseDto{ - Code: d.Code, - Name: d.Name, - Parent_Id: d.Parent_Id, + // Code: d.Code, + // Name: d.Name, + // Parent_Id: d.Parent_Id, } - resp.SmallMain = d.SmallMain + // resp.SmallMain = d.SmallMain return resp } diff --git a/internal/domain/main-entities/laborant/entity.go b/internal/domain/main-entities/laborant/entity.go index 76879825..82870b06 100644 --- a/internal/domain/main-entities/laborant/entity.go +++ b/internal/domain/main-entities/laborant/entity.go @@ -2,11 +2,12 @@ package laborant import ( ecore "simrs-vx/internal/domain/base-entities/core" + ee "simrs-vx/internal/domain/main-entities/employee" ) type Laborant struct { - ecore.SmallMain // adjust this according to the needs - Code string `json:"code" gorm:"unique;size:10"` - Name string `json:"name" gorm:"size:50"` - Parent_Id *int16 `json:"parent_id"` + ecore.Main // adjust this according to the needs + Employee_Id *uint `json:"employee_id"` + Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"` + IHS_Number *string `json:"ihs_number" gorm:"size:20"` }