Merge branch 'migration' of github.com:dikstub-rssa/simrs-be into fix/anything-moko

This commit is contained in:
dpurbosakti
2025-10-08 10:16:51 +07:00
8 changed files with 110 additions and 7 deletions
@@ -0,0 +1,2 @@
-- Modify "PersonAddress" table
ALTER TABLE "public"."PersonAddress" ADD COLUMN "PostalCode" character varying(6) NULL;
@@ -0,0 +1,12 @@
-- Create "Midwife" table
CREATE TABLE "public"."Midwife" (
"Id" bigserial NOT NULL,
"CreatedAt" timestamptz NULL,
"UpdatedAt" timestamptz NULL,
"DeletedAt" timestamptz NULL,
"Employee_Id" bigint NULL,
"IHS_Number" character varying(20) NULL,
PRIMARY KEY ("Id"),
CONSTRAINT "uni_Midwife_IHS_Number" UNIQUE ("IHS_Number"),
CONSTRAINT "fk_Midwife_Employee" FOREIGN KEY ("Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
);
+3 -1
View File
@@ -1,4 +1,4 @@
h1:4thtC22CJCQMIeVkYLmcFOT5w7S+bUUWy9wHZ21OHi8=
h1:ggc8pOi/e+U1WtE8F5K1QjGB3iuTm2Xr71jLLMn7LJc=
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
@@ -28,3 +28,5 @@ h1:4thtC22CJCQMIeVkYLmcFOT5w7S+bUUWy9wHZ21OHi8=
20251006045658.sql h1:3FmGCPCzjgMPdWDRodZTsx3KVaodd9zB9ilib69aewk=
20251006045928.sql h1:Z5g31PmnzNwk/OKdODcxZGm8fjJQdMFK32Xfnt3bRHg=
20251007022859.sql h1:FO03zEfaNEk/aXwY81d5Lp3MoBB9kPQuXlXJ4BPiSR8=
20251008031337.sql h1:IYmKye5jNMkepsnEcUzaB0lLWDGzn7dO9zT3dZxIhgY=
20251008031554.sql h1:zqUmpXDFfFgDi7I8I/izxPG6D4SPeF8B3WfpnT6mo4Y=
@@ -0,0 +1,69 @@
package midwife
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/employee"
)
type CreateDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number" validate:"maxLength=20"`
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Pagination ecore.Pagination
}
type FilterDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
}
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
Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty"`
IHS_Number *string `json:"ihs_number"`
}
func (d Midwife) ToResponse() ResponseDto {
resp := ResponseDto{
Employee_Id: d.Employee_Id,
Employee: d.Employee,
IHS_Number: d.IHS_Number,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Midwife) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,13 @@
package midwife
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/employee"
)
type Midwife struct {
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:"unique;size:20"`
}
@@ -10,5 +10,6 @@ type PersonAddress struct {
Address string `json:"address" gorm:"size:150"`
Rt string `json:"rt" gorm:"size:2"`
Rw string `json:"rw" gorm:"size:2"`
PostalCode string `json:"postalCode" gorm:"size:6"`
Village_Code string `json:"village_code" gorm:"size:10"`
}
@@ -31,12 +31,14 @@ const (
ITGCEmpFee ItemGroupCode = "employee-fee"
ITGCDocFee ItemGroupCode = "doctor-fee"
IFGCBuilding InfraGroupCode = "building" // Bangunan
IFGCFloor InfraGroupCode = "floor" // Lantai
IFGCRoom InfraGroupCode = "room" // Ruang
IFGCChamber InfraGroupCode = "chamber" // Kamar
IFGCBed InfraGroupCode = "bed" // Ranjang
IFGCWarehouse InfraGroupCode = "warehouse" // Gudang/Depo
IFGCBuilding InfraGroupCode = "building" // Bangunan
IFGCFloor InfraGroupCode = "floor" // Lantai
IFGCRoom InfraGroupCode = "room" // Ruang
IFGCChamber InfraGroupCode = "chamber" // Kamar
IFGCBed InfraGroupCode = "bed" // Ranjang
IFGCWarehouse InfraGroupCode = "warehouse" // Gudang/Depo
IFGCCounter InfraGroupCode = "counter" // Counter
IFGCPubScreen InfraGroupCode = "public-screen" // Public Screen
UTCReg UnitTypeCode = "reg" // Registrasi
UTCExa UnitTypeCode = "exa" // Pemeriksaan
@@ -47,6 +47,7 @@ import (
medicinemethod "simrs-vx/internal/domain/main-entities/medicine-method"
medicinemix "simrs-vx/internal/domain/main-entities/medicine-mix"
medicinemixitem "simrs-vx/internal/domain/main-entities/medicine-mix-item"
midwife "simrs-vx/internal/domain/main-entities/midwife"
nurse "simrs-vx/internal/domain/main-entities/nurse"
nutritionist "simrs-vx/internal/domain/main-entities/nutritionist"
patient "simrs-vx/internal/domain/main-entities/patient"
@@ -147,5 +148,6 @@ func getMainEntities() []any {
&mcuordersubitem.McuOrderSubItem{},
&consultation.Consultation{},
&chemo.Chemo{},
&midwife.Midwife{},
}
}