From f06286cbc6a8c721f21a4a7eb74bae258f8b0674 Mon Sep 17 00:00:00 2001 From: dpurbosakti Date: Mon, 25 Aug 2025 17:28:14 +0700 Subject: [PATCH] diagnosesrc, proseduresrc, pharmacycompany --- .../{division copy => diagnose-src}/dto.go | 42 ++++++------ .../main-entities/diagnose-src/entity.go | 12 ++++ .../main-entities/division copy/entity.go | 12 ---- .../main-entities/pharmacy-company/dto.go | 68 +++++++++++++++++++ .../main-entities/pharmacy-company/entity.go | 12 ++++ .../domain/main-entities/procedure-src/dto.go | 68 +++++++++++++++++++ .../main-entities/procedure-src/entity.go | 12 ++++ internal/interface/migration/migration.go | 2 + 8 files changed, 195 insertions(+), 33 deletions(-) rename internal/domain/main-entities/{division copy => diagnose-src}/dto.go (50%) create mode 100644 internal/domain/main-entities/diagnose-src/entity.go delete mode 100644 internal/domain/main-entities/division copy/entity.go create mode 100644 internal/domain/main-entities/pharmacy-company/dto.go create mode 100644 internal/domain/main-entities/pharmacy-company/entity.go create mode 100644 internal/domain/main-entities/procedure-src/dto.go create mode 100644 internal/domain/main-entities/procedure-src/entity.go diff --git a/internal/domain/main-entities/division copy/dto.go b/internal/domain/main-entities/diagnose-src/dto.go similarity index 50% rename from internal/domain/main-entities/division copy/dto.go rename to internal/domain/main-entities/diagnose-src/dto.go index 3d369cdf..42db5c5d 100644 --- a/internal/domain/main-entities/division copy/dto.go +++ b/internal/domain/main-entities/diagnose-src/dto.go @@ -1,19 +1,19 @@ -package division +package diagnosesrc 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"` + Code string `json:"code"` + Name string `json:"name"` + IndName string `json:"indName"` } type ReadListDto struct { - Code string `json:"code"` - Name string `json:"name"` - Parent_Id *int16 `json:"parent_id"` + Code string `json:"code"` + Name string `json:"name"` + IndName string `json:"indName"` Page int `json:"page"` PageSize int `json:"page_size"` @@ -21,10 +21,10 @@ type ReadListDto struct { } type ReadDetailDto struct { - Id uint16 `json:"id"` - Code string `json:"code"` - Name string `json:"name"` - Parent_Id *int16 `json:"parent_id"` + Id uint16 `json:"id"` + Code string `json:"code"` + Name string `json:"name"` + IndName string `json:"indName"` } type UpdateDto struct { @@ -43,23 +43,23 @@ type MetaDto struct { } type ResponseDto struct { - ecore.SmallMain - Code string `json:"code"` - Name string `json:"name"` - Parent_Id *int16 `json:"parent_id"` + ecore.Main + Code string `json:"code"` + Name string `json:"name"` + IndName string `json:"indName"` } -func (d Division) ToResponse() ResponseDto { +func (d DiagnoseSrc) ToResponse() ResponseDto { resp := ResponseDto{ - Code: d.Code, - Name: d.Name, - Parent_Id: d.Parent_Id, + Code: d.Code, + Name: d.Name, + IndName: d.IndName, } - resp.SmallMain = d.SmallMain + resp.Main = d.Main return resp } -func ToResponseList(users []Division) []ResponseDto { +func ToResponseList(users []DiagnoseSrc) []ResponseDto { resp := make([]ResponseDto, len(users)) for i, u := range users { resp[i] = u.ToResponse() diff --git a/internal/domain/main-entities/diagnose-src/entity.go b/internal/domain/main-entities/diagnose-src/entity.go new file mode 100644 index 00000000..82d55bb5 --- /dev/null +++ b/internal/domain/main-entities/diagnose-src/entity.go @@ -0,0 +1,12 @@ +package diagnosesrc + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" +) + +type DiagnoseSrc struct { + ecore.Main // adjust this according to the needs + Code string `json:"code" gorm:"unique;size:10"` + Name string `json:"name" gorm:"size:2048"` + IndName string `json:"indName" gorm:"size:2048"` +} diff --git a/internal/domain/main-entities/division copy/entity.go b/internal/domain/main-entities/division copy/entity.go deleted file mode 100644 index 7d3bc65d..00000000 --- a/internal/domain/main-entities/division copy/entity.go +++ /dev/null @@ -1,12 +0,0 @@ -package division - -import ( - ecore "simrs-vx/internal/domain/base-entities/core" -) - -type Division 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"` -} diff --git a/internal/domain/main-entities/pharmacy-company/dto.go b/internal/domain/main-entities/pharmacy-company/dto.go new file mode 100644 index 00000000..afd671ab --- /dev/null +++ b/internal/domain/main-entities/pharmacy-company/dto.go @@ -0,0 +1,68 @@ +package pharmacycompany + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" +) + +type CreateDto struct { + Code string `json:"code"` + Name string `json:"name"` + Regency_Code string `json:"regency_code"` +} + +type ReadListDto struct { + Code string `json:"code"` + Name string `json:"name"` + Regency_Code string `json:"regency_code"` + + 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"` + Regency_Code string `json:"regency_code"` +} + +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.Main + Code string `json:"code"` + Name string `json:"name"` + Regency_Code string `json:"regency_code"` +} + +func (d PharmacyCompany) ToResponse() ResponseDto { + resp := ResponseDto{ + Code: d.Code, + Name: d.Name, + Regency_Code: d.Regency_Code, + } + resp.Main = d.Main + return resp +} + +func ToResponseList(users []PharmacyCompany) []ResponseDto { + resp := make([]ResponseDto, len(users)) + for i, u := range users { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/pharmacy-company/entity.go b/internal/domain/main-entities/pharmacy-company/entity.go new file mode 100644 index 00000000..ffd1495e --- /dev/null +++ b/internal/domain/main-entities/pharmacy-company/entity.go @@ -0,0 +1,12 @@ +package pharmacycompany + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" +) + +type PharmacyCompany struct { + ecore.Main // adjust this according to the needs + Code string `json:"code" gorm:"unique;size:20"` + Name string `json:"name" gorm:"size:100"` + Regency_Code string `json:"regency_code" gorm:"size:4"` +} diff --git a/internal/domain/main-entities/procedure-src/dto.go b/internal/domain/main-entities/procedure-src/dto.go new file mode 100644 index 00000000..05333300 --- /dev/null +++ b/internal/domain/main-entities/procedure-src/dto.go @@ -0,0 +1,68 @@ +package proceduresrc + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" +) + +type CreateDto struct { + Code string `json:"code"` + Name string `json:"name"` + IndName string `json:"indName"` +} + +type ReadListDto struct { + Code string `json:"code"` + Name string `json:"name"` + IndName string `json:"indName"` + + 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"` + IndName string `json:"indName"` +} + +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.Main + Code string `json:"code"` + Name string `json:"name"` + IndName string `json:"indName"` +} + +func (d ProcedureSrc) ToResponse() ResponseDto { + resp := ResponseDto{ + Code: d.Code, + Name: d.Name, + IndName: d.IndName, + } + resp.Main = d.Main + return resp +} + +func ToResponseList(users []ProcedureSrc) []ResponseDto { + resp := make([]ResponseDto, len(users)) + for i, u := range users { + resp[i] = u.ToResponse() + } + return resp +} diff --git a/internal/domain/main-entities/procedure-src/entity.go b/internal/domain/main-entities/procedure-src/entity.go new file mode 100644 index 00000000..2090a42d --- /dev/null +++ b/internal/domain/main-entities/procedure-src/entity.go @@ -0,0 +1,12 @@ +package proceduresrc + +import ( + ecore "simrs-vx/internal/domain/base-entities/core" +) + +type ProcedureSrc struct { + ecore.Main // adjust this according to the needs + Code string `json:"code" gorm:"unique;size:10"` + Name string `json:"name" gorm:"size:2048"` + IndName string `json:"indName" gorm:"size:2048"` +} diff --git a/internal/interface/migration/migration.go b/internal/interface/migration/migration.go index 5c332caa..9a56490a 100644 --- a/internal/interface/migration/migration.go +++ b/internal/interface/migration/migration.go @@ -12,6 +12,7 @@ import ( person "simrs-vx/internal/domain/main-entities/person" personaddress "simrs-vx/internal/domain/main-entities/person-address" personcontact "simrs-vx/internal/domain/main-entities/person-contact" + pharmacycompany "simrs-vx/internal/domain/main-entities/pharmacy-company" province "simrs-vx/internal/domain/main-entities/province" regency "simrs-vx/internal/domain/main-entities/regency" unit "simrs-vx/internal/domain/main-entities/unit" @@ -63,6 +64,7 @@ func GetEntities() []any { &person.Person{}, &personaddress.PersonAddress{}, &personcontact.PersonContact{}, + &pharmacycompany.PharmacyCompany{}, } }