Merge pull request #48 from dikstub-rssa/fix/anything-moko

Fix/anything moko
This commit is contained in:
Dwi Atmoko Purbo Sakti
2025-10-06 14:34:55 +07:00
committed by GitHub
75 changed files with 413 additions and 315 deletions
+1
View File
@@ -14,6 +14,7 @@
"auth-login-unverified": "login failed, account is not verified",
"auth-logout-success": "logout success",
"auth-reject-suspend": "restricted for suspended account",
"auth-getData-failed": "failed to get user data",
"balance-exceeded": "must not exceeds balance",
@@ -0,0 +1,2 @@
-- Modify "DivisionPosition" table
ALTER TABLE "public"."DivisionPosition" ADD COLUMN "Employee_Id" bigint NULL, ADD CONSTRAINT "fk_DivisionPosition_Employee" FOREIGN KEY ("Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION;
@@ -0,0 +1,2 @@
-- Modify "Person" table
ALTER TABLE "public"."Person" ADD COLUMN "CommunicationIssueStatus" boolean NULL, ADD COLUMN "Disabillity" character varying(100) NULL;
@@ -0,0 +1,2 @@
-- Rename a column from "Disabillity" to "Disability"
ALTER TABLE "public"."Person" RENAME COLUMN "Disabillity" TO "Disability";
+5 -2
View File
@@ -1,4 +1,4 @@
h1:kjCOkexwu0wdD+/FPTIz43E0F/a1LI1VtyxR9B+CWyo=
h1:mTtZwYftlpTk+eVzzPqjg+OMUYcQGa39qB5fLUehDC8=
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
@@ -23,4 +23,7 @@ h1:kjCOkexwu0wdD+/FPTIz43E0F/a1LI1VtyxR9B+CWyo=
20250930140351.sql h1:9AAEG1AnOAH+o0+oHL5G7I8vqlWOhwRlCGyyCpT/y1Q=
20251002085604.sql h1:3xZ68eYp4urXRnvotNH1XvG2mYOSDV/j3zHEZ/txg5E=
20251003032030.sql h1:HB+mQ2lXMNomHDpaRhB/9IwYI9/YiDO5eOJ+nAQH/jw=
20251005060450.sql h1:zM3l4oB0U1kNpAvz47IBBIKdRW0QOGylzWHiBNLfUzs=
20251005060450.sql h1:LbtCE2b+8osM3CvnmQJH1uCPtn+d7WchsslBOz8bL3Q=
20251006041122.sql h1:MlS7f21z06sutnf9dIekt5fuHJr4lgcQ4uCuCXAGsfc=
20251006045658.sql h1:3FmGCPCzjgMPdWDRodZTsx3KVaodd9zB9ilib69aewk=
20251006045928.sql h1:bIdFndhaIdxtwEJr9aNirQTZ2bFGg9KK5PYhN8dDyUs=
+2 -2
View File
@@ -27,8 +27,8 @@ type ReadListDto struct {
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter_id"`
Employee_Id *uint `json:"employee_id"`
Encounter_Id *uint `json:"encounter-id"`
Employee_Id *uint `json:"employee-id"`
Time *time.Time `json:"time"`
Value *string `json:"value"`
}
@@ -19,8 +19,8 @@ type ReadListDto struct {
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter_id"`
Class_Code ere.AmbulatoryClassCode `json:"class_code"`
Encounter_Id *uint `json:"encounter-id"`
Class_Code ere.AmbulatoryClassCode `json:"class-code"`
}
type ReadDetailDto struct {
@@ -18,12 +18,12 @@ type CreateDto struct {
}
type ReadListDto struct {
PracticeSchedule_Id *uint `json:"practiceSchedule_id"`
Patient_Id *uint `json:"patient_id"`
Person_ResidentIdentityNumber string `json:"person_residentIdentityNumber"`
Person_Name string `json:"person_name"`
Person_PhoneNumber string `json:"person_phoneNumber"`
PaymentMethod_Code erc.PaymentMethodCode `json:"paymentMethod_code"`
PracticeSchedule_Id *uint `json:"practiceSchedule-id"`
Patient_Id *uint `json:"patient-id"`
Person_ResidentIdentityNumber string `json:"person-residentIdentityNumber"`
Person_Name string `json:"person-name"`
Person_PhoneNumber string `json:"person-phoneNumber"`
PaymentMethod_Code erc.PaymentMethodCode `json:"paymentMethod-code"`
RefNumber string `json:"refNumber"`
Pagination ecore.Pagination
}
+7 -7
View File
@@ -16,7 +16,7 @@ import (
type CreateDto struct {
Encounter_Id *uint `json:"encounter_id"`
Status_Code erc.DataVerifiedCode `json:"status_code"`
SrcUnit_Id *uint `json:"src_unit_id"`
SrcUnit_Id *uint `json:"srcUnit_id"`
}
type ReadListDto struct {
@@ -27,10 +27,10 @@ type ReadListDto struct {
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter_id"`
Status_Code *erc.DataVerifiedCode `json:"status_code"`
VerifiedBy_User_Id *uint `json:"verifiedBy_user_id"`
SrcUnit_Id *uint `json:"src_unit_id"`
Encounter_Id *uint `json:"encounter-id"`
Status_Code *erc.DataVerifiedCode `json:"status-code"`
VerifiedBy_User_Id *uint `json:"verifiedBy-user-id"`
SrcUnit_Id *uint `json:"srcUnit-id"`
}
type ReadDetailDto struct {
@@ -67,8 +67,8 @@ type ResponseDto struct {
VerifiedAt *time.Time `json:"verifiedAt"`
VerifiedBy_User_Id *uint `json:"verifiedBy_user_id"`
VerifiedBy *eus.User `json:"verifiedBy,omitempty"`
SrcUnit_Id *uint `json:"src_unit_id"`
SrcUnit *eun.Unit `json:"src_unit,omitempty"`
SrcUnit_Id *uint `json:"srcUnit_id"`
SrcUnit *eun.Unit `json:"srcUnit,omitempty"`
}
func (d Chemo) ToResponse() ResponseDto {
@@ -19,6 +19,6 @@ type Chemo struct {
VerifiedAt *time.Time `json:"verifiedAt"`
VerifiedBy_User_Id *uint `json:"verifiedBy_user_id"`
VerifiedBy *eus.User `json:"verifiedBy,omitempty" gorm:"foreignKey:VerifiedBy_User_Id;references:Id"`
SrcUnit_Id *uint `json:"src_unit_id"`
SrcUnit *eun.Unit `json:"src_unit,omitempty" gorm:"foreignKey:SrcUnit_Id;references:Id"`
SrcUnit_Id *uint `json:"srcUnit_id"`
SrcUnit *eun.Unit `json:"srcUnit,omitempty" gorm:"foreignKey:SrcUnit_Id;references:Id"`
}
@@ -26,9 +26,9 @@ type ReadListDto struct {
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter_id"`
DstUnit_Id *uint `json:"dstUnit_id"`
DstDoctor_Id *uint `json:"dstDoctor_id"`
Encounter_Id *uint `json:"encounter-id"`
DstUnit_Id *uint `json:"dstUnit-id"`
DstDoctor_Id *uint `json:"dstDoctor-id"`
}
type ReadDetailDto struct {
+3 -3
View File
@@ -17,9 +17,9 @@ type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Number uint8 `json:"number"`
Parent_Id *uint16 `json:"parent_id"`
Type_Code string `json:"type_code"`
Queue_Code string `json:"queue_code"`
Parent_Id *uint16 `json:"parent-id"`
Type_Code string `json:"type-code"`
Queue_Code string `json:"queue-code"`
Pagination ecore.Pagination
}
@@ -20,8 +20,8 @@ type ReadListDto struct {
}
type FilterDto struct {
DeviceOrder_Id *uint `json:"deviceOrder_id"`
Device_Id *uint `json:"device_id"`
DeviceOrder_Id *uint `json:"deviceOrder-id"`
Device_Id *uint `json:"device-id"`
Count uint8 `json:"count"`
}
type ReadDetailDto struct {
@@ -26,9 +26,9 @@ type ReadListDto struct {
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter_id"`
Status_Code erc.DataStatusCode `json:"status_code"`
Doctor_Id *uint `json:"doctor_id"`
Encounter_Id *uint `json:"encounter-id"`
Status_Code erc.DataStatusCode `json:"status-code"`
Doctor_Id *uint `json:"doctor-id"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
+3 -3
View File
@@ -26,9 +26,9 @@ type ReadListDto struct {
type FilterDto struct {
Code string `json:"code"`
Name string `json:"name"`
Uom_Code string `json:"uom_code"`
Infra_Id *uint16 `json:"infra_id"`
Item_Id *uint `json:"item_id"`
Uom_Code string `json:"uom-code"`
Infra_Id *uint16 `json:"infra-id"`
Item_Id *uint `json:"item-id"`
}
type ReadDetailDto struct {
@@ -12,7 +12,7 @@ type CreateDto struct {
}
type ReadListDto struct {
Regency_Code string `json:"regency_code"`
Regency_Code string `json:"regency-code"`
Code string `json:"code"`
Name string `json:"name"`
Pagination ecore.Pagination
@@ -3,12 +3,14 @@ package divisionposition
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ed "simrs-vx/internal/domain/main-entities/division"
ee "simrs-vx/internal/domain/main-entities/employee"
)
type CreateDto struct {
Division_Id *uint16 `json:"division_id"`
Code string `json:"code" validate:"maxLength=10"`
Name string `json:"name" validate:"maxLength=50"`
Employee_Id *uint `json:"employee_id"`
}
type ReadListDto struct {
@@ -19,9 +21,10 @@ type ReadListDto struct {
}
type FilterDto struct {
Division_Id *uint16 `json:"division_id"`
Division_Id *uint16 `json:"division-id"`
Code string `json:"code"`
Name string `json:"name"`
Employee_Id *uint `json:"employee-id"`
}
type ReadDetailDto struct {
@@ -50,6 +53,8 @@ type ResponseDto struct {
Division *ed.Division `json:"division,omitempty"`
Code string `json:"code"`
Name string `json:"name"`
Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty"`
}
func (d DivisionPosition) ToResponse() ResponseDto {
@@ -57,6 +62,8 @@ func (d DivisionPosition) ToResponse() ResponseDto {
Division_Id: d.Division_Id,
Code: d.Code,
Name: d.Name,
Employee_Id: d.Employee_Id,
Employee: d.Employee,
}
resp.SmallMain = d.SmallMain
if d.Division != nil {
@@ -3,6 +3,7 @@ package divisionposition
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ed "simrs-vx/internal/domain/main-entities/division"
ee "simrs-vx/internal/domain/main-entities/employee"
)
type DivisionPosition struct {
@@ -11,4 +12,6 @@ type DivisionPosition struct {
Division *ed.Division `json:"division" gorm:"foreignKey:Division_Id"`
Code string `json:"code" gorm:"unique;size:10"`
Name string `json:"name" gorm:"size:50"`
Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
}
@@ -22,7 +22,7 @@ type ReadListDto struct {
type FilterDto struct {
Code string `json:"code"`
Name string `json:"name"`
Parent_Id *uint16 `json:"parent_id"`
Parent_Id *uint16 `json:"parent-id"`
}
type ReadDetailDto struct {
@@ -22,10 +22,10 @@ type ReadListDto struct {
}
type FilterDto struct {
Doctor_Id *uint `json:"doctor_id"`
FeeType_Code *ero.DoctorFeeTypeCode `json:"feeType_code"`
Doctor_Id *uint `json:"doctor-id"`
FeeType_Code *ero.DoctorFeeTypeCode `json:"feeType-code"`
Price *float64 `json:"price"`
Item_Id *uint `json:"item_id"`
Item_Id *uint `json:"item-id"`
}
type ReadDetailDto struct {
+6 -6
View File
@@ -25,12 +25,12 @@ type ReadListDto struct {
}
type FilterDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number" validate:"maxLength=20"`
SIP_Number *string `json:"sip_number" validate:"maxLength=20"`
Unit_Id *uint `json:"unit_id"`
Specialist_Id *uint16 `json:"specialist_id"`
Subspecialist_Id *uint16 `json:"subspecialist_id"`
Employee_Id *uint `json:"employee-id"`
IHS_Number *string `json:"ihs-number" validate:"maxLength=20"`
SIP_Number *string `json:"sip-number" validate:"maxLength=20"`
Unit_Id *uint `json:"unit-id"`
Specialist_Id *uint16 `json:"specialist-id"`
Subspecialist_Id *uint16 `json:"subspecialist-id"`
}
type ReadDetailDto struct {
@@ -19,8 +19,8 @@ type ReadListDto struct {
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter_id"`
Class_Code ere.EmergencyClassCode `json:"class_code"`
Encounter_Id *uint `json:"encounter-id"`
Class_Code ere.EmergencyClassCode `json:"class-code"`
}
type ReadDetailDto struct {
@@ -25,11 +25,11 @@ type ReadListDto struct {
}
type FilterDto struct {
User_Id *uint `json:"user_id"`
Person_Id *uint `json:"person_id"`
Division_Code *string `json:"division_code"`
User_Id *uint `json:"user-id"`
Person_Id *uint `json:"person-id"`
Division_Code *string `json:"division-code"`
Number *string `json:"number"`
Status_Code erc.ActiveStatusCode `json:"status_code"`
Status_Code erc.ActiveStatusCode `json:"status-code"`
}
type ReadDetailDto struct {
@@ -39,19 +39,19 @@ type ReadListDto struct {
}
type FilterDto struct {
Patient_Id *uint `json:"patient_id"`
Patient_Id *uint `json:"patient-id"`
Patient *ep.Patient `json:"patient,omitempty"`
RegisteredAt *time.Time `json:"registeredAt"`
Class_Code ere.EncounterClassCode `json:"class_code" validate:"maxLength=10"`
Unit_Id *uint `json:"unit_id"`
Specialist_Id *uint16 `json:"specialist_id"`
Subspecialist_Id *uint16 `json:"subspecialist_id"`
Unit_Id *uint `json:"unit-id"`
Specialist_Id *uint16 `json:"specialist-id"`
Subspecialist_Id *uint16 `json:"subspecialist-id"`
VisitDate time.Time `json:"visitDate"`
Appoinment_Doctor_Id *uint `json:"appointment_doctor_id"`
Responsible_Doctor_Id *uint `json:"responsible_doctor_id"`
DischargeMethod_Code ere.DischargeMethodCode `json:"dischargeMethod_code" validate:"maxLength=10"`
RefSource_Name *string `json:"refSource_name" validate:"maxLength=100"`
Appointment_Id *uint `json:"appointment_id"`
Appoinment_Doctor_Id *uint `json:"appointment-doctor-id"`
Responsible_Doctor_Id *uint `json:"responsible-doctor-id"`
DischargeMethod_Code ere.DischargeMethodCode `json:"dischargeMethod-code" validate:"maxLength=10"`
RefSource_Name *string `json:"refSource-name" validate:"maxLength=100"`
Appointment_Id *uint `json:"appointment-id"`
EarlyEducation *string `json:"earlyEducation"`
MedicalDischargeEducation *string `json:"medicalDischargeEducation"`
AdmDischargeEducation *string `json:"admDischargeEducation"`
+3 -3
View File
@@ -31,9 +31,9 @@ type ReadListDto struct {
type FilterDto struct {
Code string `json:"code"`
Name string `json:"name"`
InfraGroup_Code ero.InfraGroupCode `json:"infraGroup_code"`
Parent_Id *uint16 `json:"parent_id"`
Item_Id *uint `json:"item_id"`
InfraGroup_Code ero.InfraGroupCode `json:"infraGroup-code"`
Parent_Id *uint16 `json:"parent-id"`
Item_Id *uint `json:"item-id"`
}
type ReadDetailDto struct {
@@ -22,9 +22,9 @@ type ReadListDto struct {
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter_id"`
Class_Code ere.InpatientClassCode `json:"class_code"`
Infra_Id *uint16 `json:"infra_id"`
Encounter_Id *uint `json:"encounter-id"`
Class_Code ere.InpatientClassCode `json:"class-code"`
Infra_Id *uint16 `json:"infra-id"`
}
type ReadDetailDto struct {
@@ -15,7 +15,7 @@ type CreateDto struct {
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code"`
EncounterClass_Code ere.EncounterClassCode `json:"encounterClass-code"`
Pagination ecore.Pagination
}
@@ -23,7 +23,7 @@ type ReadListDto struct {
type FilterDto struct {
Code string `json:"code"`
Name string `json:"name"`
Regency_Code *string `json:"regency_code"`
Regency_Code *string `json:"regency-code"`
Address string `json:"address"`
PhoneNumber string `json:"phoneNumber"`
}
@@ -20,9 +20,9 @@ type ReadListDto struct {
}
type FilterDto struct {
Item_Id *uint `json:"item_id"`
Item_Id *uint `json:"item-id"`
Price float64 `json:"price"`
InsuranceCompany_Code *string `json:"insuranceCompany_code"`
InsuranceCompany_Code *string `json:"insuranceCompany-code"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
+3 -3
View File
@@ -25,9 +25,9 @@ type ReadListDto struct {
type FilterDto struct {
Code string `json:"code"`
Name string `json:"name"`
ItemGroup_Code ero.ItemGroupCode `json:"itemGroup_code"`
Uom_Code *string `json:"uom_code"`
Infra_Id *uint16 `json:"infra_id"`
ItemGroup_Code ero.ItemGroupCode `json:"itemGroup-code"`
Uom_Code *string `json:"uom-code"`
Infra_Id *uint16 `json:"infra-id"`
Stock *int `json:"stock"`
}
@@ -18,8 +18,8 @@ type ReadListDto struct {
}
type FilterDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
Employee_Id *uint `json:"employee-id"`
IHS_Number *string `json:"ihs-number"`
}
type ReadDetailDto struct {
@@ -20,8 +20,8 @@ type ReadListDto struct {
}
type FilterDto struct {
MaterialOrder_Id *uint `json:"materialOrder_id"`
Material_Id *uint `json:"material_id"`
MaterialOrder_Id *uint `json:"materialOrder-id"`
Material_Id *uint `json:"material-id"`
Count *uint16 `json:"count"`
}
type ReadDetailDto struct {
@@ -26,7 +26,7 @@ type ReadListDto struct {
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter_id"`
Encounter_Id *uint `json:"encounter-id"`
Status_Code erc.DataStatusCode `json:"status_code"`
}
type ReadDetailDto struct {
@@ -27,10 +27,10 @@ type ReadListDto struct {
type FilterDto struct {
Code string `json:"code"`
Name string `json:"name"`
Uom_Code string `json:"uom_code"`
Infra_Id *uint16 `json:"infra_id"`
Uom_Code string `json:"uom-code"`
Infra_Id *uint16 `json:"infra-id"`
Stock *int `json:"stock"`
Item_Id *uint `json:"item_id"`
Item_Id *uint `json:"item-id"`
}
type ReadDetailDto struct {
@@ -24,10 +24,10 @@ type ReadListDto struct {
}
type FilterDto struct {
McuOrder_Id *uint `json:"mcuOrder_id"`
McuSrc_Id *uint `json:"mcuSrc_id"`
McuOrder_Id *uint `json:"mcuOrder-id"`
McuSrc_Id *uint `json:"mcuSrc-id"`
Result *string `json:"result"`
Status_Code erc.DataStatusCode `json:"status_code"`
Status_Code erc.DataStatusCode `json:"status-code"`
}
type ReadDetailDto struct {
Id uint `json:"id"`
@@ -22,10 +22,10 @@ type ReadListDto struct {
}
type FilterDto struct {
McuOrder_Id *uint `json:"mcuOrder_id"`
McuSrc_Id *uint `json:"mcuSrc_id"`
McuOrder_Id *uint `json:"mcuOrder-id"`
McuSrc_Id *uint `json:"mcuSrc-id"`
Result *string `json:"result"`
Status_Code erc.DataStatusCode `json:"status_code"`
Status_Code erc.DataStatusCode `json:"status-code"`
}
type ReadDetailDto struct {
Id uint `json:"id"`
@@ -33,14 +33,14 @@ type ReadListDto struct {
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter_id"`
Status_Code erc.DataStatusCode `json:"status_code" gorm:"not null;size:10"`
Doctor_Id *uint `json:"doctor_id"`
Encounter_Id *uint `json:"encounter-id"`
Status_Code erc.DataStatusCode `json:"status-code" gorm:"not null;size:10"`
Doctor_Id *uint `json:"doctor-id"`
SpecimenPickTime *time.Time `json:"specimenPickTime"`
ExaminationDate *time.Time `json:"examinationDate"`
Number uint8 `json:"number"`
Temperature float64 `json:"temperature"`
McuUrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"mcuUrgencyLevel_code""`
McuUrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"mcuUrgencyLevel-code""`
}
type ReadDetailDto struct {
Id uint `json:"id"`
@@ -15,7 +15,7 @@ type CreateDto struct {
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Scope_Code *ere.CheckupScopeCode `json:"scope_code"`
Scope_Code *ere.CheckupScopeCode `json:"scope-code"`
Pagination ecore.Pagination
}
+1 -1
View File
@@ -23,7 +23,7 @@ type ReadListDto struct {
type FilterDto struct {
Code string `json:"code"`
Name string `json:"name"`
McuSrcCategory_Code *string `json:"mcuSrcCategory_code"`
McuSrcCategory_Code *string `json:"mcuSrcCategory-code"`
}
type ReadDetailDto struct {
@@ -24,7 +24,7 @@ type ReadListDto struct {
type FilterDto struct {
Code string `json:"code"`
Name string `json:"name"`
CheckupCategory_Code *string `json:"checkupCategory_code"`
CheckupCategory_Code *string `json:"checkupCategory-code"`
}
type ReadDetailDto struct {
@@ -21,9 +21,9 @@ type ReadListDto struct {
}
type FilterDto struct {
MedicalActionSrc_Id *uint `json:"medicalActionSrc_id"`
ProcedureSrc_Id *uint `json:"procedureSrc_id"`
Item_Id *uint `json:"item_id"`
MedicalActionSrc_Id *uint `json:"medicalActionSrc-id"`
ProcedureSrc_Id *uint `json:"procedureSrc-id"`
Item_Id *uint `json:"item-id"`
}
type ReadDetailDto struct {
@@ -22,7 +22,7 @@ type ReadListDto struct {
type FilterDto struct {
Code string `json:"code"`
Name string `json:"name"`
Item_Id *uint `json:"item_id"`
Item_Id *uint `json:"item-id"`
}
type ReadDetailDto struct {
@@ -24,10 +24,10 @@ type ReadListDto struct {
}
type FilterDto struct {
MedicationItem_Id *uint `json:"medicationItem_id"`
MedicationItem_Id *uint `json:"medicationItem-id"`
DateTime *time.Time `json:"dateTime"`
Remain float64 `json:"remain"`
Nurse_Id *uint `json:"nurse_id"`
Nurse_Id *uint `json:"nurse-id"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
@@ -33,13 +33,13 @@ type ReadListDto struct {
}
type FilterDto struct {
Medication_Id *uint `json:"medication_id"`
Medication_Id *uint `json:"medication-id"`
IsMix bool `json:"isMix"`
Medicine_Id *uint `json:"medicine_id"`
MedicineMix_Id *uint `json:"medicineMix_id"`
Medicine_Id *uint `json:"medicine-id"`
MedicineMix_Id *uint `json:"medicineMix-id"`
Usage float64 `json:"usage"`
Interval uint8 `json:"interval"`
IntervalUnit_Code erc.TimeUnitCode `json:"intervalUnit_code"`
IntervalUnit_Code erc.TimeUnitCode `json:"intervalUnit-code"`
IsRedeemed bool `json:"isRedeemed"`
Quantity float64 `json:"quantity"`
Note *string `json:"note" gorm:"size:1024"`
@@ -27,10 +27,10 @@ type ReadListDto struct {
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter_id"`
Encounter_Id *uint `json:"encounter-id"`
IssuedAt *time.Time `json:"issuedAt"`
Pharmacist_Id *uint `json:"pharmacist_id"`
Status_Code erc.DataStatusCode `json:"status_code"`
Pharmacist_Id *uint `json:"pharmacist-id"`
Status_Code erc.DataStatusCode `json:"status-code"`
}
type ReadDetailDto struct {
Id uint `json:"id"`
@@ -20,8 +20,8 @@ type ReadListDto struct {
}
type FilterDto struct {
MedicineMix_Id *uint `json:"medicineMix_id"`
Medicine_Id *uint `json:"medicine_id"`
MedicineMix_Id *uint `json:"medicineMix-id"`
Medicine_Id *uint `json:"medicine-id"`
Dose *uint8 `json:"dose"`
Note *string `json:"note" gom:"size:1024"`
}
@@ -13,7 +13,7 @@ type CreateDto struct {
type ReadListDto struct {
Name string `json:"name"`
Uom_Code *string `json:"uom_code"`
Uom_Code *string `json:"uom-code"`
Pagination ecore.Pagination
}
@@ -32,13 +32,13 @@ type ReadListDto struct {
type FilterDto struct {
Code string `json:"code"`
Name string `json:"name"`
MedicineGroup_Code *string `json:"medicineGroup_code"`
MedicineMethod_Code *string `json:"medicineMethod_code"`
Uom_Code *string `json:"uom_code"`
MedicineGroup_Code *string `json:"medicineGroup-code"`
MedicineMethod_Code *string `json:"medicineMethod-code"`
Uom_Code *string `json:"uom-code"`
Dose uint8 `json:"dose"`
Infra_Id *uint16 `json:"infra_id"`
Infra_Id *uint16 `json:"infra-id"`
Stock *int `json:"stock"`
Item_Id *uint `json:"item_id"`
Item_Id *uint `json:"item-id"`
}
type ReadDetailDto struct {
+4 -4
View File
@@ -22,10 +22,10 @@ type ReadListDto struct {
}
type FilterDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
Unit_Id *uint16 `json:"unit_id"`
Infra_Id *uint16 `json:"infra_id"`
Employee_Id *uint `json:"employee-id"`
IHS_Number *string `json:"ihs-number"`
Unit_Id *uint16 `json:"unit-id"`
Infra_Id *uint16 `json:"infra-id"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
@@ -18,8 +18,8 @@ type ReadListDto struct {
}
type FilterDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
Employee_Id *uint `json:"employee-id"`
IHS_Number *string `json:"ihs-number"`
}
type ReadDetailDto struct {
+2 -2
View File
@@ -32,9 +32,9 @@ type ReadListDto struct {
}
type FilterDto struct {
Person_Id *uint `json:"person_id"`
Person_Id *uint `json:"person-id"`
RegisteredAt *time.Time `json:"registeredAt"`
Status_Code erc.ActiveStatusCode `json:"status_code"`
Status_Code erc.ActiveStatusCode `json:"status-code"`
Number *string `json:"number"`
}
@@ -28,17 +28,16 @@ type ReadListDto struct {
}
type FilterDto struct {
Person_Id uint `json:"person_id"`
Relationship_Code erp.RelationshipCode `json:"relationship_code" `
Person_Id uint `json:"person-id"`
Relationship_Code erp.RelationshipCode `json:"relationship-code" `
Name *string `json:"name"`
Address *string `json:"address"`
Village_Code *string `json:"village_code"`
Village *ev.Village `json:"village,omitempty"`
Gender_Code *erp.GenderCode `json:"gender_code"`
Village_Code *string `json:"village-code"`
Gender_Code *erp.GenderCode `json:"gender-code"`
PhoneNumber *string `json:"phoneNumber"`
Education_Code *erp.EducationCode `json:"education_code"`
Occupation_Code *erp.OcupationCode `json:"occupation_code"`
Occupation_Name *string `json:"occupation_name"`
Education_Code *erp.EducationCode `json:"education-code"`
Occupation_Code *erp.OcupationCode `json:"occupation-code"`
Occupation_Name *string `json:"occupation-name"`
Responsible bool `json:"responsible"`
}
+88 -80
View File
@@ -13,22 +13,24 @@ import (
)
type CreateDto struct {
Name string `json:"name" validate:"maxLength=150"`
FrontTitle *string `json:"frontTitle" validate:"maxLength=50"`
EndTitle *string `json:"endTitle" validate:"maxLength=50"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency_code" validate:"maxLength=4"`
Gender_Code *erp.GenderCode `json:"gender_code"`
ResidentIdentityNumber *string `json:"residentIdentityNumber" validate:"nik;maxLength=16"`
PassportNumber *string `json:"passportNumber" validate:"maxLength=20"`
DrivingLicenseNumber *string `json:"drivingLicenseNumber" validate:"maxLength=20"`
Religion_Code *erp.ReligionCode `json:"religion_code" validate:"maxLength=10"`
Education_Code *erp.EducationCode `json:"education_code" validate:"maxLength=10"`
Ocupation_Code *erp.OcupationCode `json:"occupation_code" validate:"maxLength=15"`
Ocupation_Name *string `json:"occupation_name" validate:"maxLength=50"`
Nationality *string `json:"nationality" validate:"maxLength=50"`
Ethnic_Code *string `json:"ethnic_code" validate:"maxLength=20"`
Language_Code *string `json:"language_code" validate:"maxLength=10"`
Name string `json:"name" validate:"maxLength=150"`
FrontTitle *string `json:"frontTitle" validate:"maxLength=50"`
EndTitle *string `json:"endTitle" validate:"maxLength=50"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency_code" validate:"maxLength=4"`
Gender_Code *erp.GenderCode `json:"gender_code"`
ResidentIdentityNumber *string `json:"residentIdentityNumber" validate:"nik;maxLength=16"`
PassportNumber *string `json:"passportNumber" validate:"maxLength=20"`
DrivingLicenseNumber *string `json:"drivingLicenseNumber" validate:"maxLength=20"`
Religion_Code *erp.ReligionCode `json:"religion_code" validate:"maxLength=10"`
Education_Code *erp.EducationCode `json:"education_code" validate:"maxLength=10"`
Ocupation_Code *erp.OcupationCode `json:"occupation_code" validate:"maxLength=15"`
Ocupation_Name *string `json:"occupation_name" validate:"maxLength=50"`
Nationality *string `json:"nationality" validate:"maxLength=50"`
Ethnic_Code *string `json:"ethnic_code" validate:"maxLength=20"`
Language_Code *string `json:"language_code" validate:"maxLength=10"`
CommunicationIssueStatus bool `json:"communicationIssueStatus"`
Disability *string `json:"disability" validate:"maxLength=100"`
}
type ReadListDto struct {
@@ -39,22 +41,24 @@ type ReadListDto struct {
}
type FilterDto struct {
Name string `json:"name"`
FrontTitle *string `json:"frontTitle"`
EndTitle *string `json:"endTitle"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency_code"`
Gender_Code *erp.GenderCode `json:"gender_code"`
ResidentIdentityNumber *string `json:"residentIdentityNumber"`
PassportNumber *string `json:"passportNumber"`
DrivingLicenseNumber *string `json:"drivingLicenseNumber"`
Religion_Code *erp.ReligionCode `json:"religion_code"`
Education_Code *erp.EducationCode `json:"education_code"`
Ocupation_Code *erp.OcupationCode `json:"occupation_code"`
Ocupation_Name *string `json:"occupation_name"`
Nationality *string `json:"nationality"`
Ethnic_Code *string `json:"ethnic_code"`
Language_Code *string `json:"language_code"`
Name string `json:"name"`
FrontTitle *string `json:"frontTitle"`
EndTitle *string `json:"endTitle"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency-code"`
Gender_Code *erp.GenderCode `json:"gender-code"`
ResidentIdentityNumber *string `json:"residentIdentityNumber"`
PassportNumber *string `json:"passportNumber"`
DrivingLicenseNumber *string `json:"drivingLicenseNumber"`
Religion_Code *erp.ReligionCode `json:"religion-code"`
Education_Code *erp.EducationCode `json:"education-code"`
Ocupation_Code *erp.OcupationCode `json:"occupation-code"`
Ocupation_Name *string `json:"occupation-name"`
Nationality *string `json:"nationality"`
Ethnic_Code *string `json:"ethnic-code"`
Language_Code *string `json:"language-code"`
CommunicationIssueStatus bool `json:"communicationIssueStatus"`
Disability *string `json:"disability"`
}
type ReadDetailDto struct {
@@ -82,58 +86,62 @@ type MetaDto struct {
type ResponseDto struct {
ecore.Main
Name string `json:"name"`
FrontTitle *string `json:"frontTitle"`
EndTitle *string `json:"endTitle"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency_code"`
Gender_Code *erp.GenderCode `json:"gender_code"`
ResidentIdentityNumber *string `json:"residentIdentityNumber"`
PassportNumber *string `json:"passportNumber"`
DrivingLicenseNumber *string `json:"drivingLicenseNumber"`
Religion_Code *erp.ReligionCode `json:"religion_code"`
Education_Code *erp.EducationCode `json:"education_code"`
Ocupation_Code *erp.OcupationCode `json:"occupation_code"`
Ocupation_Name *string `json:"occupation_name"`
Nationality *string `json:"nationality"`
Ethnic_Code *string `json:"ethnic_code"`
Ethnic *ee.Ethnic `json:"ethnic,omitempty"`
Addresses *[]epa.PersonAddress `json:"addresses,omitempty"`
Contacts *[]epc.PersonContact `json:"contacts,omitempty"`
Relatives *[]epr.PersonRelative `json:"relatives,omitempty"`
Language_Code *string `json:"language_code"`
ResidentIdentityFileUrl *string `json:"residentIdentityFileUrl"`
PassportFileUrl *string `json:"passportFileUrl"`
DrivingLicenseFileUrl *string `json:"drivingLicenseFileUrl"`
FamilyIdentityFileUrl *string `json:"familyIdentityFileUrl"`
Name string `json:"name"`
FrontTitle *string `json:"frontTitle"`
EndTitle *string `json:"endTitle"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency_code"`
Gender_Code *erp.GenderCode `json:"gender_code"`
ResidentIdentityNumber *string `json:"residentIdentityNumber"`
PassportNumber *string `json:"passportNumber"`
DrivingLicenseNumber *string `json:"drivingLicenseNumber"`
Religion_Code *erp.ReligionCode `json:"religion_code"`
Education_Code *erp.EducationCode `json:"education_code"`
Ocupation_Code *erp.OcupationCode `json:"occupation_code"`
Ocupation_Name *string `json:"occupation_name"`
Nationality *string `json:"nationality"`
Ethnic_Code *string `json:"ethnic_code"`
Ethnic *ee.Ethnic `json:"ethnic,omitempty"`
Addresses *[]epa.PersonAddress `json:"addresses,omitempty"`
Contacts *[]epc.PersonContact `json:"contacts,omitempty"`
Relatives *[]epr.PersonRelative `json:"relatives,omitempty"`
Language_Code *string `json:"language_code"`
CommunicationIssueStatus bool `json:"communicationIssueStatus"`
Disability *string `json:"disability"`
ResidentIdentityFileUrl *string `json:"residentIdentityFileUrl"`
PassportFileUrl *string `json:"passportFileUrl"`
DrivingLicenseFileUrl *string `json:"drivingLicenseFileUrl"`
FamilyIdentityFileUrl *string `json:"familyIdentityFileUrl"`
}
func (d *Person) ToResponse() ResponseDto {
resp := ResponseDto{
Name: d.Name,
FrontTitle: d.FrontTitle,
EndTitle: d.EndTitle,
BirthDate: d.BirthDate,
BirthRegency_Code: d.BirthRegency_Code,
Gender_Code: d.Gender_Code,
ResidentIdentityNumber: d.ResidentIdentityNumber,
PassportNumber: d.PassportNumber,
DrivingLicenseNumber: d.DrivingLicenseNumber,
Religion_Code: d.Religion_Code,
Education_Code: d.Education_Code,
Ocupation_Code: d.Ocupation_Code,
Ocupation_Name: d.Ocupation_Name,
Nationality: d.Nationality,
Ethnic_Code: d.Ethnic_Code,
Ethnic: d.Ethnic,
Addresses: d.Addresses,
Contacts: d.Contacts,
Relatives: d.Relatives,
Language_Code: d.Language_Code,
ResidentIdentityFileUrl: d.ResidentIdentityFileUrl,
PassportFileUrl: d.PassportFileUrl,
DrivingLicenseFileUrl: d.DrivingLicenseFileUrl,
FamilyIdentityFileUrl: d.FamilyIdentityFileUrl,
Name: d.Name,
FrontTitle: d.FrontTitle,
EndTitle: d.EndTitle,
BirthDate: d.BirthDate,
BirthRegency_Code: d.BirthRegency_Code,
Gender_Code: d.Gender_Code,
ResidentIdentityNumber: d.ResidentIdentityNumber,
PassportNumber: d.PassportNumber,
DrivingLicenseNumber: d.DrivingLicenseNumber,
Religion_Code: d.Religion_Code,
Education_Code: d.Education_Code,
Ocupation_Code: d.Ocupation_Code,
Ocupation_Name: d.Ocupation_Name,
Nationality: d.Nationality,
Ethnic_Code: d.Ethnic_Code,
Ethnic: d.Ethnic,
Addresses: d.Addresses,
Contacts: d.Contacts,
Relatives: d.Relatives,
Language_Code: d.Language_Code,
CommunicationIssueStatus: d.CommunicationIssueStatus,
Disability: d.Disability,
ResidentIdentityFileUrl: d.ResidentIdentityFileUrl,
PassportFileUrl: d.PassportFileUrl,
DrivingLicenseFileUrl: d.DrivingLicenseFileUrl,
FamilyIdentityFileUrl: d.FamilyIdentityFileUrl,
}
resp.Main = d.Main
return resp
+28 -26
View File
@@ -13,32 +13,34 @@ import (
)
type Person struct {
ecore.Main // adjust this according to the needs
Name string `json:"name" gorm:"not null;size:150"`
FrontTitle *string `json:"frontTitle" gorm:"size:50"`
EndTitle *string `json:"endTitle" gorm:"size:50"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency_code" gorm:"size:4"`
Gender_Code *erp.GenderCode `json:"gender_code" gorm:"size:10"`
ResidentIdentityNumber *string `json:"residentIdentityNumber" gorm:"unique;size:16"`
PassportNumber *string `json:"passportNumber" gorm:"unique;size:20"`
DrivingLicenseNumber *string `json:"drivingLicenseNumber" gorm:"unique;size:20"`
Religion_Code *erp.ReligionCode `json:"religion_code" gorm:"size:10"`
Education_Code *erp.EducationCode `json:"education_code" gorm:"size:10"`
Ocupation_Code *erp.OcupationCode `json:"occupation_code" gorm:"size:15"`
Ocupation_Name *string `json:"occupation_name" gorm:"size:50"`
Nationality *string `json:"nationality": gorm:"size:50"`
Ethnic_Code *string `json:"ethnic_code" gorm:"size:20"`
Ethnic *ee.Ethnic `json:"ethnic,omitempty" gorm:"foreignKey:Ethnic_Code;references:Code"`
Addresses *[]epa.PersonAddress `json:"addresses" gorm:"foreignKey:Person_Id"`
Contacts *[]epc.PersonContact `json:"contacts" gorm:"foreignKey:Person_Id"`
Relatives *[]epr.PersonRelative `json:"relatives" gorm:"foreignKey:Person_Id"`
Language_Code *string `json:"language_code" gorm:"size:10"`
Language *el.Language `json:"language,omitempty" gorm:"foreignKey:Language_Code;references:Code"`
ResidentIdentityFileUrl *string `json:"residentIdentityFileUrl" gorm:"size:1024"`
PassportFileUrl *string `json:"passportFileUrl" gorm:"size:1024"`
DrivingLicenseFileUrl *string `json:"drivingLicenseFileUrl" gorm:"size:1024"`
FamilyIdentityFileUrl *string `json:"familyIdentityFileUrl" gorm:"size:1024"`
ecore.Main // adjust this according to the needs
Name string `json:"name" gorm:"not null;size:150"`
FrontTitle *string `json:"frontTitle" gorm:"size:50"`
EndTitle *string `json:"endTitle" gorm:"size:50"`
BirthDate *time.Time `json:"birthDate,omitempty"`
BirthRegency_Code *string `json:"birthRegency_code" gorm:"size:4"`
Gender_Code *erp.GenderCode `json:"gender_code" gorm:"size:10"`
ResidentIdentityNumber *string `json:"residentIdentityNumber" gorm:"unique;size:16"`
PassportNumber *string `json:"passportNumber" gorm:"unique;size:20"`
DrivingLicenseNumber *string `json:"drivingLicenseNumber" gorm:"unique;size:20"`
Religion_Code *erp.ReligionCode `json:"religion_code" gorm:"size:10"`
Education_Code *erp.EducationCode `json:"education_code" gorm:"size:10"`
Ocupation_Code *erp.OcupationCode `json:"occupation_code" gorm:"size:15"`
Ocupation_Name *string `json:"occupation_name" gorm:"size:50"`
Nationality *string `json:"nationality": gorm:"size:50"`
Ethnic_Code *string `json:"ethnic_code" gorm:"size:20"`
Ethnic *ee.Ethnic `json:"ethnic,omitempty" gorm:"foreignKey:Ethnic_Code;references:Code"`
Addresses *[]epa.PersonAddress `json:"addresses" gorm:"foreignKey:Person_Id"`
Contacts *[]epc.PersonContact `json:"contacts" gorm:"foreignKey:Person_Id"`
Relatives *[]epr.PersonRelative `json:"relatives" gorm:"foreignKey:Person_Id"`
Language_Code *string `json:"language_code" gorm:"size:10"`
Language *el.Language `json:"language,omitempty" gorm:"foreignKey:Language_Code;references:Code"`
CommunicationIssueStatus bool `json:"communicationIssueStatus"`
Disability *string `json:"disability" gorm:"size:100"`
ResidentIdentityFileUrl *string `json:"residentIdentityFileUrl" gorm:"size:1024"`
PassportFileUrl *string `json:"passportFileUrl" gorm:"size:1024"`
DrivingLicenseFileUrl *string `json:"drivingLicenseFileUrl" gorm:"size:1024"`
FamilyIdentityFileUrl *string `json:"familyIdentityFileUrl" gorm:"size:1024"`
}
func (d Person) IsSameResidentIdentityNumber(input *string) bool {
@@ -18,8 +18,8 @@ type ReadListDto struct {
}
type FilterDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
Employee_Id *uint `json:"employee-id"`
IHS_Number *string `json:"ihs-number"`
}
type ReadDetailDto struct {
@@ -13,7 +13,7 @@ type CreateDto struct {
type ReadListDto struct {
Code string `json:"code"`
Name string `json:"name"`
Regency_Code string `json:"regency_code"`
Regency_Code string `json:"regency-code"`
Pagination ecore.Pagination
}
@@ -21,9 +21,9 @@ type ReadListDto struct {
}
type FilterDto struct {
Doctor_Id *uint `json:"doctor_id"`
Unit_Code *string `json:"unit_code"`
Day_Code *erc.DayCode `json:"day_code"`
Doctor_Id *uint `json:"doctor-id"`
Unit_Code *string `json:"unit-code"`
Day_Code *erc.DayCode `json:"day-code"`
StartTime *string `json:"startTime"`
EndTime *string `json:"endTime"`
}
@@ -31,13 +31,13 @@ type ReadListDto struct {
}
type FilterDto struct {
Prescription_Id *uint `json:"prescription_id"`
Prescription_Id *uint `json:"prescription-id"`
IsMix bool `json:"isMix"`
Medicine_Id *uint `json:"medicine_id"`
MedicineMix_Id *uint `json:"medicineMix_id"`
Medicine_Id *uint `json:"medicine-id"`
MedicineMix_Id *uint `json:"medicineMix-id"`
Usage float64 `json:"usage"`
Interval uint8 `json:"interval"`
IntervalUnit_Code erc.TimeUnitCode `json:"intervalUnit_code"`
IntervalUnit_Code erc.TimeUnitCode `json:"intervalUnit-code"`
Quantity float64 `json:"quantity"`
}
type ReadDetailDto struct {
@@ -25,10 +25,10 @@ type ReadListDto struct {
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter_id"`
Doctor_Id *uint `json:"doctor_id"`
Encounter_Id *uint `json:"encounter-id"`
Doctor_Id *uint `json:"doctor-id"`
IssuedAt *time.Time `json:"issuedAt"`
Status_Code *erc.DataStatusCode `json:"status_code"`
Status_Code *erc.DataStatusCode `json:"status-code"`
}
type ReadDetailDto struct {
Id uint `json:"id"`
+1 -1
View File
@@ -12,7 +12,7 @@ type CreateDto struct {
}
type ReadListDto struct {
Province_Code string `json:"province_code"`
Province_Code string `json:"province-code"`
Code string `json:"code"`
Name string `json:"name"`
Pagination ecore.Pagination
+4 -4
View File
@@ -23,10 +23,10 @@ type ReadListDto struct {
}
type FilterDto struct {
Infra_Id *uint16 `json:"infra_id"`
Unit_Id *uint16 `json:"unit_id"`
Specialist_Id *uint16 `json:"specialist_id"`
Subspecialist_Id *uint16 `json:"subspecialist_id"`
Infra_Id *uint16 `json:"infra-id"`
Unit_Id *uint16 `json:"unit-id"`
Specialist_Id *uint16 `json:"specialist-id"`
Subspecialist_Id *uint16 `json:"subspecialist-id"`
}
type ReadDetailDto struct {
+2 -2
View File
@@ -27,8 +27,8 @@ type ReadListDto struct {
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter_id"`
Employee_Id *uint `json:"employee_id"`
Encounter_Id *uint `json:"encounter-id"`
Employee_Id *uint `json:"employee-id"`
Time *time.Time `json:"time"`
Value *string `json:"value"`
}
+2 -2
View File
@@ -30,8 +30,8 @@ type ReadListDto struct {
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter_id"`
Employee_Id *uint `json:"employee_id"`
Encounter_Id *uint `json:"encounter-id"`
Employee_Id *uint `json:"employee-id"`
Time *time.Time `json:"time"`
TypeCode erc.SoapiTypeCode `json:"typeCode"`
Value *string `json:"value"`
@@ -23,10 +23,10 @@ type ReadListDto struct {
}
type FilterDto struct {
Person_Id *uint `json:"person_id"`
Specialist_Id *uint16 `json:"specialist_id"`
Subspecialist_Id *uint16 `json:"subspecialist_id"`
User_Id *uint `json:"user_id"`
Person_Id *uint `json:"person-id"`
Specialist_Id *uint16 `json:"specialist-id"`
Subspecialist_Id *uint16 `json:"subspecialist-id"`
User_Id *uint `json:"user-id"`
}
type ReadDetailDto struct {
@@ -21,7 +21,7 @@ type ReadListDto struct {
type FilterDto struct {
Code string `json:"code"`
Name string `json:"name"`
Unit_Id *uint16 `json:"unit_id"`
Unit_Id *uint16 `json:"unit-id"`
}
type ReadDetailDto struct {
@@ -21,7 +21,7 @@ type ReadListDto struct {
type FilterDto struct {
Code *string `json:"code"`
Name *string `json:"name"`
Specialist_Id *uint16 `json:"specialist_id"`
Specialist_Id *uint16 `json:"specialist-id"`
}
type ReadDetailDto struct {
+1 -1
View File
@@ -20,7 +20,7 @@ type ReadListDto struct {
}
type FilterDto struct {
Installation_Id *uint16 `json:"installation_id"`
Installation_Id *uint16 `json:"installation-id"`
Code string `json:"code"`
Name string `json:"name"`
}
+1 -1
View File
@@ -32,7 +32,7 @@ type CreateDto struct {
type ReadListDto struct {
Name string `json:"name"`
Status_Code erc.UserStatusCode `json:"status_code"`
Status_Code erc.UserStatusCode `json:"status-code"`
Pagination ecore.Pagination
}
+1 -1
View File
@@ -11,7 +11,7 @@ type CreateDto struct {
}
type ReadListDto struct {
District_Code string `json:"district_code"`
District_Code string `json:"district-code"`
Code string `json:"code"`
Name string `json:"name"`
Pagination ecore.Pagination
@@ -9,19 +9,19 @@ import (
"github.com/golang-jwt/jwt"
"github.com/google/uuid"
dg "github.com/karincake/apem/db-gorm-pg"
d "github.com/karincake/dodol"
l "github.com/karincake/lepet"
a "github.com/karincake/apem"
ms "github.com/karincake/apem/ms-redis"
eu "simrs-vx/internal/domain/main-entities/user"
erc "simrs-vx/internal/domain/references/common"
pa "simrs-vx/pkg/auth-helper"
el "simrs-vx/pkg/logger"
p "simrs-vx/pkg/password"
eu "simrs-vx/internal/domain/main-entities/user"
erc "simrs-vx/internal/domain/references/common"
a "github.com/karincake/apem"
dg "github.com/karincake/apem/db-gorm-pg"
ms "github.com/karincake/apem/ms-redis"
d "github.com/karincake/dodol"
l "github.com/karincake/lepet"
)
var authCfg AuthCfg
@@ -38,7 +38,7 @@ func GenToken(input eu.LoginDto) (*d.Data, error) {
// if input.Position_Code != "" {
// user.Position_Code = input.Position_Code
// }
if errCode := GetAndCheck(user, user); errCode != "" {
if errCode := getAndCheck(user, user); errCode != "" {
return nil, d.FieldErrors{"authentication": d.FieldError{Code: errCode, Message: el.GenMessage(errCode)}}
}
@@ -72,6 +72,11 @@ func GenToken(input eu.LoginDto) (*d.Data, error) {
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-login-unverified", Message: el.GenMessage("auth-login-unverified")}}
}
userDivisionPositions, err := getDivisionPosition(user.Id)
if err != nil {
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-getData-failed", Message: el.GenMessage("auth-getData-failed")}}
}
// Access token prep
id, err := uuid.NewRandom()
if err != nil {
@@ -85,20 +90,14 @@ func GenToken(input eu.LoginDto) (*d.Data, error) {
atExpires := time.Now().Add(duration).Unix()
atSecretKey := authCfg.AtSecretKey
// extra
// if input.Position_Code == "doc" {
// }
// Creating Access Token
atClaims := jwt.MapClaims{}
atClaims["user_id"] = user.Id
atClaims["user_name"] = user.Name
// atClaims["user_email"] = user.Email
atClaims["user_position_code"] = user.Position_Code
// atClaims["user_ref_id"] = user.Ref_Id
atClaims["exp"] = atExpires
atClaims["uuid"] = aUuid
atClaims["user_division_positions"] = userDivisionPositions
at := jwt.NewWithClaims(jwt.SigningMethodHS256, atClaims)
ats, err := at.SignedString([]byte(atSecretKey))
if err != nil {
@@ -127,12 +126,11 @@ func GenToken(input eu.LoginDto) (*d.Data, error) {
"status": "verified",
},
Data: d.II{
"user_id": strconv.Itoa(int(user.Id)),
"user_name": user.Name,
// "user_email": user.Email,
"user_position_code": user.Position_Code,
// "user_ref_id": user.Ref_Id,
"accessToken": ats,
"user_id": strconv.Itoa(int(user.Id)),
"user_name": user.Name,
"user_position_code": user.Position_Code,
"accessToken": ats,
"user_division_positions": userDivisionPositions,
},
}, nil
}
@@ -188,26 +186,41 @@ func ExtractToken(r *http.Request, tokenType TokenType) (data *pa.AuthInfo, err
return nil, d.FieldError{Code: "token-unidentified", Message: el.GenMessage("token-unidentified")}
}
user_name := fmt.Sprintf("%v", claims["user_name"])
// user_email := ""
// if v, exist := claims["user_email"]; exist && v != nil {
// user_email = v.(string)
// }
// ref_id := 0
// if v, exist := claims["user_ref_id"]; exist && v != nil {
// tmp := v.(float64)
// ref_id = int(tmp)
// }
var userDivisionPositions []pa.DivisionPosition
raw := claims["user_division_positions"]
if raw == nil {
fmt.Println("No user_division_positions found in claims")
} else {
list, ok := raw.([]interface{})
if !ok {
fmt.Printf("user_division_positions is not []interface{}, but %T\n", raw)
} else {
fmt.Printf("Found %d division positions\n", len(list))
for i, item := range list {
if m, ok := item.(map[string]interface{}); ok {
fmt.Printf("Item %d: %v\n", i, m)
dp := pa.DivisionPosition{
Division_Code: fmt.Sprintf("%v", m["division_code"]),
DivisionPosition_Code: fmt.Sprintf("%v", m["divisionPosition_code"]),
}
userDivisionPositions = append(userDivisionPositions, dp)
} else {
fmt.Printf("Item %d not map[string]interface{} but %T\n", i, item)
}
}
}
}
position_code := ""
if v, exist := claims["user_position_code"]; exist && v != nil {
position_code = v.(string)
}
data = &pa.AuthInfo{
Uuid: accessUuid,
User_Id: uint(user_id),
User_Name: user_name,
// User_Email: user_email,
// User_Ref_Id: ref_id,
User_Position_Code: position_code,
Uuid: accessUuid,
User_Id: uint(user_id),
User_Name: user_name,
User_Position_Code: position_code,
User_DivisionPositions: userDivisionPositions,
}
return
}
@@ -1,11 +1,18 @@
package authentication
import (
"errors"
edp "simrs-vx/internal/domain/main-entities/division-position"
ee "simrs-vx/internal/domain/main-entities/employee"
pa "simrs-vx/pkg/auth-helper"
dg "github.com/karincake/apem/db-gorm-pg"
"gorm.io/gorm"
)
// just return the error code
func GetAndCheck(input, condition any) (eCode string) {
func getAndCheck(input, condition any) (eCode string) {
result := dg.I.Where(condition).Find(&input)
if result.Error != nil {
return "fetch-fail"
@@ -16,6 +23,44 @@ func GetAndCheck(input, condition any) (eCode string) {
return ""
}
func GetDocName(id uint) string {
func getDocName(id uint) string {
return "authentication"
}
func getDivisionPosition(user_id uint) ([]pa.DivisionPosition, error) {
var result []pa.DivisionPosition
var employee ee.Employee
if err := dg.I.Where("\"User_Id\" = ?", user_id).First(&employee).Error; err != nil {
if err == gorm.ErrRecordNotFound {
return result, nil
}
return result, errors.New("no employee found")
}
var divisionPositions []edp.DivisionPosition
err := dg.I.
Preload("Division").
Where("\"Employee_Id\" = ?", employee.Id).
Find(&divisionPositions).Error
if err != nil {
if err == gorm.ErrRecordNotFound {
return result, nil
}
return result, err
}
for _, dp := range divisionPositions {
result = append(result, pa.DivisionPosition{
Division_Code: func() string {
if dp.Division != nil {
return dp.Division.Code
}
return ""
}(),
DivisionPosition_Code: dp.Code,
})
}
return result, nil
}
@@ -20,4 +20,5 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.DivisionPosition) {
data.Division_Id = inputSrc.Division_Id
data.Code = inputSrc.Code
data.Name = inputSrc.Name
data.Employee_Id = inputSrc.Employee_Id
}
@@ -33,4 +33,6 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Person) {
data.Nationality = inputSrc.Nationality
data.Ethnic_Code = inputSrc.Ethnic_Code
data.Language_Code = inputSrc.Language_Code
data.CommunicationIssueStatus = inputSrc.CommunicationIssueStatus
data.Disability = inputSrc.Disability
}
+10 -6
View File
@@ -7,12 +7,16 @@ import (
type AuthKey struct{}
type AuthInfo struct {
Uuid string
User_Id uint
User_Name string
// User_Email string
// User_Ref_Id int
User_Position_Code string
Uuid string
User_Id uint
User_Name string
User_DivisionPositions []DivisionPosition
User_Position_Code string
}
type DivisionPosition struct {
Division_Code string `json:"division_code"`
DivisionPosition_Code string `json:"divisionPosition_code"`
}
func (a AuthInfo) IsDoctor() bool {
+5 -1
View File
@@ -118,7 +118,11 @@ func GetPreloads(input string) []string {
result := []string{}
parts := strings.Split(input, ",")
for _, p := range parts {
result = append(result, kebabToPascal(p))
subParts := strings.Split(p, "-")
for i := range subParts {
subParts[i] = kebabToPascal(subParts[i])
}
result = append(result, strings.Join(subParts, "."))
}
return result
}