diff --git a/cmd/main-migration/migrations/20251202231005.sql b/cmd/main-migration/migrations/20251202231005.sql new file mode 100644 index 00000000..65fe436a --- /dev/null +++ b/cmd/main-migration/migrations/20251202231005.sql @@ -0,0 +1,14 @@ +-- Modify "MaterialPackageItem" table +ALTER TABLE "public"."MaterialPackageItem" ADD COLUMN "Count" integer NULL; +-- Create "ProcedureRoomOrderItem" table +CREATE TABLE "public"."ProcedureRoomOrderItem" ( + "Id" bigserial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "ProcedureRoomOrder_Id" bigint NULL, + "ProcedureRoom_Code" character varying(20) NULL, + "Note" character varying(255) NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "fk_ProcedureRoomOrderItem_ProcedureRoom" FOREIGN KEY ("ProcedureRoom_Code") REFERENCES "public"."ProcedureRoom" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION +); diff --git a/cmd/main-migration/migrations/atlas.sum b/cmd/main-migration/migrations/atlas.sum index 26c2bca0..c949eadc 100644 --- a/cmd/main-migration/migrations/atlas.sum +++ b/cmd/main-migration/migrations/atlas.sum @@ -1,4 +1,4 @@ -h1:fDxiVQJUurcI/J078Wz7tEKkfNwnI92Cs75Z34Eo9ZQ= +h1:MO6ze6e6ClW/WxUyiZxT6Lmhz8BDgXmmYeLDSN4xEJw= 20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k= 20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0= 20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI= @@ -142,4 +142,5 @@ h1:fDxiVQJUurcI/J078Wz7tEKkfNwnI92Cs75Z34Eo9ZQ= 20251202064000.sql h1:/EN7sT1ol/91qW1aXWrzX+Mc3XOC/7f/LtfA0JRHpbg= 20251202130629.sql h1:9mvalqfhqGCdkcJepJDzHprU2xb0i5sYys1Htf62ioo= 20251202160848.sql h1:Kd2/TziKSMezrt4XgbjQcYvY/Lo9rX0qw7/Lz0/oyKk= -20251202180207.sql h1:5WXemmJfgaV3BPuciiDhstKjjhSRCCxIxuPB8c7nc74= +20251202180207.sql h1:IHmSMIO3ia+YV5GULixbdlV1joaUAWtnjQHPd8+HKiM= +20251202231005.sql h1:iVzsqbqmfncDXPPXoRqCQdcvgvLBv57TbzdbzQAmSVc= diff --git a/internal/domain/main-entities/material-package-item/dto.go b/internal/domain/main-entities/material-package-item/dto.go index e642a015..60b7e313 100644 --- a/internal/domain/main-entities/material-package-item/dto.go +++ b/internal/domain/main-entities/material-package-item/dto.go @@ -49,7 +49,7 @@ type ResponseDto struct { MaterialPackage *emp.MaterialPackage `json:"materialPackage,omitempty"` Material_Code string `json:"material_code"` Material *em.Material `json:"material,omitempty"` - Count uint16 `json:"count"` + Count *uint16 `json:"count"` } func (d MaterialPackageItem) ToResponse() ResponseDto { diff --git a/internal/domain/main-entities/material-package-item/entity.go b/internal/domain/main-entities/material-package-item/entity.go index 52960935..0c45969b 100644 --- a/internal/domain/main-entities/material-package-item/entity.go +++ b/internal/domain/main-entities/material-package-item/entity.go @@ -12,5 +12,5 @@ type MaterialPackageItem struct { MaterialPackage *emp.MaterialPackage `json:"materialPackage" gorm:"foreignKey:MaterialPackage_Code;references:Code"` Material_Code string `json:"code" gorm:"size:20;not null"` Material *em.Material `json:"material" gorm:"foreignKey:Material_Code;references:Code"` - Count uint16 `json:"count" gorm:"not null"` + Count *uint16 `json:"count"` } diff --git a/internal/interface/migration/main-entities.go b/internal/interface/migration/main-entities.go index 0d118fae..34530d78 100644 --- a/internal/interface/migration/main-entities.go +++ b/internal/interface/migration/main-entities.go @@ -84,6 +84,7 @@ import ( prescriptionitem "simrs-vx/internal/domain/main-entities/prescription-item" procedureroom "simrs-vx/internal/domain/main-entities/procedure-room" procedureroomorder "simrs-vx/internal/domain/main-entities/procedure-room-order" + procedureroomorderitem "simrs-vx/internal/domain/main-entities/procedure-room-order-item" proceduresrc "simrs-vx/internal/domain/main-entities/procedure-src" province "simrs-vx/internal/domain/main-entities/province" regency "simrs-vx/internal/domain/main-entities/regency" @@ -207,6 +208,7 @@ func getMainEntities() []any { &postalregion.PostalRegion{}, &internalreference.InternalReference{}, &procedureroomorder.ProcedureRoomOrder{}, + &procedureroomorderitem.ProcedureRoomOrderItem{}, &vclaimsephist.VclaimSepHist{}, &vclaimsepprint.VclaimSepPrint{},