From b65c86750ab673866c46b21e7980e4d6c78e561d Mon Sep 17 00:00:00 2001 From: Munawwirul Jamal Date: Mon, 1 Dec 2025 18:39:28 +0700 Subject: [PATCH] feat/action-report: new migration --- .../migrations/20251201113804.sql | 2 ++ .../migrations/20251201113858.sql | 2 ++ cmd/main-migration/migrations/atlas.sum | 4 ++- .../domain/main-entities/action-report/dto.go | 29 ++++++++++--------- .../main-entities/action-report/entity.go | 12 ++++---- 5 files changed, 28 insertions(+), 21 deletions(-) create mode 100644 cmd/main-migration/migrations/20251201113804.sql create mode 100644 cmd/main-migration/migrations/20251201113858.sql diff --git a/cmd/main-migration/migrations/20251201113804.sql b/cmd/main-migration/migrations/20251201113804.sql new file mode 100644 index 00000000..0f5c5123 --- /dev/null +++ b/cmd/main-migration/migrations/20251201113804.sql @@ -0,0 +1,2 @@ +-- Modify "ActionReport" table +ALTER TABLE "public"."ActionReport" DROP COLUMN "Date", DROP COLUMN "Procedures"; diff --git a/cmd/main-migration/migrations/20251201113858.sql b/cmd/main-migration/migrations/20251201113858.sql new file mode 100644 index 00000000..fd6fddc9 --- /dev/null +++ b/cmd/main-migration/migrations/20251201113858.sql @@ -0,0 +1,2 @@ +-- Modify "ActionReport" table +ALTER TABLE "public"."ActionReport" ADD COLUMN "Date" timestamptz NOT NULL; diff --git a/cmd/main-migration/migrations/atlas.sum b/cmd/main-migration/migrations/atlas.sum index 8f71fcc5..db6de529 100644 --- a/cmd/main-migration/migrations/atlas.sum +++ b/cmd/main-migration/migrations/atlas.sum @@ -1,4 +1,4 @@ -h1:NUsCmkoiBso9yZsv4HWrn3+woqMcFRFtgXKln5rY4pQ= +h1:EpEYOCY46tEg91o5Y4scmFj3/yIyR311HaP95Ts3vus= 20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k= 20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0= 20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI= @@ -133,3 +133,5 @@ h1:NUsCmkoiBso9yZsv4HWrn3+woqMcFRFtgXKln5rY4pQ= 20251126064057.sql h1:vAdhz5Nn/gGJy0UKZAEldeXv8HpHtJU/t8ygDVIbTsU= 20251201081333.sql h1:PoC8ADRdwDuohDTB74yW/DaB42igdYa4B6humbrEJBk= 20251201104439.sql h1:tpqdrOf9d2aGwZshqm62nG6SXnfVaO/g6A7z0efPS14= +20251201113804.sql h1:pR0nbmjJNDLi929vmGm2W9RKxLJ2iECzf2otO+JpKWA= +20251201113858.sql h1:JciS3xbCF94huB0qkGJ24YtS1a+nqV26hxzeKh2AOj0= diff --git a/internal/domain/main-entities/action-report/dto.go b/internal/domain/main-entities/action-report/dto.go index 1edb4a73..45c26d17 100644 --- a/internal/domain/main-entities/action-report/dto.go +++ b/internal/domain/main-entities/action-report/dto.go @@ -3,20 +3,21 @@ package actionreport import ( ecore "simrs-vx/internal/domain/base-entities/core" ee "simrs-vx/internal/domain/main-entities/encounter" + "time" pa "simrs-vx/internal/lib/auth" ) type CreateDto struct { - Encounter_Id uint64 `json:"encounter_id"` - Date string `json:"date"` - Doctor_Code string `json:"doctor_code"` - Operator_Employe_Id *uint `json:"operator_employe_id"` - Assistant_Employe_Id *uint `json:"assistant_employe_id"` - Instrumentor_Employe_Id *uint `json:"instrumentor_employe_id"` - Diagnose *string `json:"diagnose"` - Nurse_Code *string `json:"nurse_code"` - Value string `json:"value"` + Encounter_Id uint64 `json:"encounter_id" validate:"required"` + Date *time.Time `json:"date" validate:"required"` + Doctor_Code string `json:"doctor_code" validate:"required"` + Operator_Employe_Id uint `json:"operator_employe_id" validate:"required"` + Assistant_Employe_Id uint `json:"assistant_employe_id" validate:"required"` + Instrumentor_Employe_Id uint `json:"instrumentor_employe_id" validate:"required"` + Diagnose *string `json:"diagnose"` + Nurse_Code string `json:"nurse_code" validate:"required"` + Value string `json:"value" validate:"required"` pa.AuthInfo } @@ -54,13 +55,13 @@ type ResponseDto struct { ecore.Main Encounter_Id uint64 `json:"encounter_id"` Encounter *ee.Encounter `json:"encounter,omitempty"` - Date string `json:"date"` + Date *time.Time `json:"date"` Doctor_Code string `json:"doctor_code"` - Operator_Employe_Id *uint `json:"operator_employe_id"` - Assistant_Employe_Id *uint `json:"assistant_employe_id"` - Instrumentor_Employe_Id *uint `json:"instrumentor_employe_id"` + Operator_Employe_Id uint `json:"operator_employe_id"` + Assistant_Employe_Id uint `json:"assistant_employe_id"` + Instrumentor_Employe_Id uint `json:"instrumentor_employe_id"` Diagnose *string `json:"diagnose"` - Nurse_Code *string `json:"nurse_code"` + Nurse_Code string `json:"nurse_code"` Value *string `json:"value"` } diff --git a/internal/domain/main-entities/action-report/entity.go b/internal/domain/main-entities/action-report/entity.go index 3437136e..b3fc1956 100644 --- a/internal/domain/main-entities/action-report/entity.go +++ b/internal/domain/main-entities/action-report/entity.go @@ -3,20 +3,20 @@ package actionreport import ( ecore "simrs-vx/internal/domain/base-entities/core" ee "simrs-vx/internal/domain/main-entities/encounter" + "time" ) type ActionReport struct { ecore.Main // adjust this according to the needs Encounter_Id uint64 `json:"encounter_id" gorm:"foreignKey"` Encounter *ee.Encounter `json:"doctor,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"` - Date string `json:"date" gorm:"not null;size:20"` + Date *time.Time `json:"date" gorm:"not null;size:20"` Doctor_Code string `json:"doctor_code" gorm:"size:10"` - Operator_Employe_Id *uint `json:"operator_employe_id"` - Assistant_Employe_Id *uint `json:"assistant_employe_id"` - Instrumentor_Employe_Id *uint `json:"instrumentor_employe_id"` + Operator_Employe_Id uint `json:"operator_employe_id"` + Assistant_Employe_Id uint `json:"assistant_employe_id"` + Instrumentor_Employe_Id uint `json:"instrumentor_employe_id"` Diagnose *string `json:"diagnose" gorm:"size:1024"` - Procedures *string `json:"procedures" gorm:"size:10240"` - Nurse_Code *string `json:"nurse_code" gorm:"size:10"` + Nurse_Code string `json:"nurse_code" gorm:"size:10"` Value string `json:"value"` // SurgerySize_Code *string `json:"surgerySize_code" gorm:"size:10"`