Merge branch 'migration' of github.com:dikstub-rssa/simrs-be into feat/employee

This commit is contained in:
dpurbosakti
2025-09-04 11:53:40 +07:00
7 changed files with 101 additions and 3 deletions
@@ -0,0 +1,12 @@
-- Create "Laborant" table
CREATE TABLE "public"."Laborant" (
"Id" serial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Code" character varying(10) NULL,
"Name" character varying(50) NULL,
"Parent_Id" smallint NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_Laborant_Code" UNIQUE ("Code")
);
@@ -0,0 +1,2 @@
-- Modify "Patient" table
ALTER TABLE "public"."Patient" ADD CONSTRAINT "uni_Patient_Number" UNIQUE ("Number");
+4 -2
View File
@@ -1,4 +1,4 @@
h1:179RYs36FGTJB7o/kUCO3K612TUM4fbHOaI3UBdlmlU=
h1:SEKp4pTgTBf9j9WlbMblM56D9bo7EgXZbCgN5aCmycE=
20250829081952.sql h1:YMsYq3uPsx70EjWSGfYnVRR5GV0q1fRGIszYZAWzXNo=
20250901073356.sql h1:jjd5TLs+Pyi0u3SrOM+aNTbHxSJboXgcOz/L4bkYx+c=
20250901080035.sql h1:LWa3X0NWjalVcxNbk5HaHj1Oqu60/AQabi0jBmCeQBI=
@@ -7,4 +7,6 @@ h1:179RYs36FGTJB7o/kUCO3K612TUM4fbHOaI3UBdlmlU=
20250902063217.sql h1:wYFIrAIp1RczNvzlmu8jP8P1J7xEXqgDLKDUNBbkt84=
20250902105300.sql h1:6N2SDYK3a6djaO6u468E/DrDR9kM+uYoJvNlTFon6bY=
20250903041718.sql h1:ZiaacurDuBwWaI348Sjo7VZ6rSsj9TLTkudiRv05C/w=
20250903073200.sql h1:Tnxfz/3JjvrwPie2FYuhmfo5xFNeQV1lH+qbBJjpm5g=
20250903073200.sql h1:4i/3uJdYiAuKZ6upRK+xXUHBN7xHSK8G5QjaDkQt8E8=
20250904045113.sql h1:Ak/LiCz/prpIBkufkJkJIrx1/MJUdrryAAhoF2d+6Zg=
20250904045250.sql h1:UhHhYtF1CdKa29LuYb8ZNduVmXQEg9tu0pY0aHe/Njg=
@@ -0,0 +1,68 @@
package laborant
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
Code string `json:"code"`
Name string `json:"name"`
Parent_Id *int16 `json:"parent_id"`
}
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Parent_Id *int16 `json:"parent_id"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
Parent_Id *int16 `json:"parent_id"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.SmallMain
Code string `json:"code"`
Name string `json:"name"`
Parent_Id *int16 `json:"parent_id"`
}
func (d Laborant) ToResponse() ResponseDto {
resp := ResponseDto{
Code: d.Code,
Name: d.Name,
Parent_Id: d.Parent_Id,
}
resp.SmallMain = d.SmallMain
return resp
}
func ToResponseList(data []Laborant) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,12 @@
package laborant
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
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"`
}
@@ -13,5 +13,5 @@ type Patient struct {
Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id;references:Id"`
RegisteredAt *time.Time `json:"registeredAt"`
Status_Code erc.ActiveStatusCode `json:"status_code" gorm:"not null;size:10"`
Number *string `json:"number" gorm:"size:15"`
Number *string `json:"number" gorm:"unique;size:15"`
}
@@ -21,6 +21,7 @@ import (
insurancecompany "simrs-vx/internal/domain/main-entities/insurance-company"
item "simrs-vx/internal/domain/main-entities/item"
itemprice "simrs-vx/internal/domain/main-entities/item-price"
laborant "simrs-vx/internal/domain/main-entities/laborant"
language "simrs-vx/internal/domain/main-entities/language"
material "simrs-vx/internal/domain/main-entities/material"
mcusrc "simrs-vx/internal/domain/main-entities/mcu-src"
@@ -127,6 +128,7 @@ func GetEntities() []any {
&personrelative.PersonRelative{},
&patient.Patient{},
&encounter.Encounter{},
&laborant.Laborant{},
}
}