rename and adjust upload code into doctypecode
This commit is contained in:
@@ -9,12 +9,12 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Type_Code eru.UploadCode `json:"type_code"`
|
||||
Name string `json:"name"`
|
||||
FilePath string `json:"filePath"`
|
||||
Filename string `json:"-"`
|
||||
Upload_Employee_Id *uint `form:"upload_employee_id"`
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Type_Code eru.DocTypeCode `json:"type_code"`
|
||||
Name string `json:"name"`
|
||||
FilePath string `json:"filePath"`
|
||||
Filename string `json:"-"`
|
||||
Upload_Employee_Id *uint `form:"upload_employee_id"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -24,9 +24,9 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Encounter_Id *uint `json:"encounter-id"`
|
||||
Type_Code eru.UploadCode `json:"type-code"`
|
||||
Upload_Employee_Id *string `json:"encounter-document-employee-id"`
|
||||
Encounter_Id *uint `json:"encounter-id"`
|
||||
Type_Code eru.DocTypeCode `json:"type-code"`
|
||||
Upload_Employee_Id *string `json:"encounter-document-employee-id"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
@@ -51,13 +51,13 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Type_Code eru.UploadCode `json:"type_code"`
|
||||
Name string `json:"name"`
|
||||
FilePath *string `json:"filePath"`
|
||||
FileName *string `json:"fileName"`
|
||||
Upload_Employee_Id *uint `json:"upload_employee_id"`
|
||||
Upload_Employee *ee.Employee `json:"upload_employee,omitempty"`
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Type_Code eru.DocTypeCode `json:"type_code"`
|
||||
Name string `json:"name"`
|
||||
FilePath *string `json:"filePath"`
|
||||
FileName *string `json:"fileName"`
|
||||
Upload_Employee_Id *uint `json:"upload_employee_id"`
|
||||
Upload_Employee *ee.Employee `json:"upload_employee,omitempty"`
|
||||
}
|
||||
|
||||
func (d EncounterDocument) ToResponse() ResponseDto {
|
||||
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
|
||||
type EncounterDocument struct {
|
||||
ecore.Main
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Type_Code eru.UploadCode `json:"type_code"`
|
||||
Name string `json:"name"`
|
||||
FilePath *string `json:"filePath"`
|
||||
FileName *string `json:"fileName"`
|
||||
Upload_Employee_Id *uint `json:"upload_employee_id"`
|
||||
Upload_Employee *ee.Employee `json:"upload_employee,omitempty" gorm:"foreignKey:Upload_Employee_Id;references:Id"`
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Type_Code eru.DocTypeCode `json:"type_code"`
|
||||
Name string `json:"name"`
|
||||
FilePath *string `json:"filePath"`
|
||||
FileName *string `json:"fileName"`
|
||||
Upload_Employee_Id *uint `json:"upload_employee_id"`
|
||||
Upload_Employee *ee.Employee `json:"upload_employee,omitempty" gorm:"foreignKey:Upload_Employee_Id;references:Id"`
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ type SearchDto struct {
|
||||
|
||||
type UploadDto struct {
|
||||
Id uint `json:"-"`
|
||||
Code eru.UploadCode `json:"-"`
|
||||
Code eru.DocTypeCode `json:"-"`
|
||||
File multipart.File `json:"-"`
|
||||
FileHeader *multipart.FileHeader `json:"-"`
|
||||
Filename string `json:"-"`
|
||||
|
||||
@@ -3,6 +3,7 @@ package upload
|
||||
import (
|
||||
"mime/multipart"
|
||||
eru "simrs-vx/internal/domain/references/upload"
|
||||
|
||||
// internal - domain - base-entities
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
)
|
||||
@@ -10,7 +11,7 @@ import (
|
||||
type CreateDto struct {
|
||||
EntityType_Code eru.EntityTypeCode `form:"entityType_code"`
|
||||
Ref_Id *uint `form:"ref_id"`
|
||||
Type_Code eru.UploadCode `form:"type_code"`
|
||||
Type_Code eru.DocTypeCode `form:"type_code"`
|
||||
Name string `form:"name"`
|
||||
Upload_Employee_Id *uint `form:"upload_employee_id"`
|
||||
FilePath string `json:"-"`
|
||||
@@ -31,7 +32,7 @@ type ReadListDto struct {
|
||||
type FilterDto struct {
|
||||
EntityType_Code eru.EntityTypeCode `json:"entityType-code"`
|
||||
Ref_Id *uint `json:"ref-id"`
|
||||
Type_Code eru.UploadCode `json:"type-code"`
|
||||
Type_Code eru.DocTypeCode `json:"type-code"`
|
||||
Name string `json:"name"`
|
||||
FilePath *string `json:"filePath"`
|
||||
FileName *string `json:"fileName"`
|
||||
@@ -61,7 +62,7 @@ type MetaDto struct {
|
||||
type ResponseDto struct {
|
||||
EntityType_Code eru.EntityTypeCode `json:"entityType_code"`
|
||||
Ref_Id *uint `json:"ref_id"`
|
||||
Type_Code eru.UploadCode `json:"type_code"`
|
||||
Type_Code eru.DocTypeCode `json:"type_code"`
|
||||
Name string `json:"name"`
|
||||
Upload_Employee_Id *uint `json:"upload_employee_id"`
|
||||
FilePath string `json:"filePath"`
|
||||
|
||||
@@ -3,40 +3,41 @@ package upload
|
||||
import "fmt"
|
||||
|
||||
type (
|
||||
UploadCode string
|
||||
DocTypeCode string
|
||||
EntityTypeCode string
|
||||
)
|
||||
|
||||
const (
|
||||
UCPRN UploadCode = "person-resident-number" // Person Resident Number
|
||||
UCPDL UploadCode = "person-driver-license" // Person Driver License
|
||||
UCPP UploadCode = "person-passport" // Person Passport
|
||||
UCPFC UploadCode = "person-family-card" // Person Family Card
|
||||
UCMIR UploadCode = "mcu-item-result" // Mcu Item Result
|
||||
UCEnPatient UploadCode = "encounter-patient"
|
||||
UCEnSupport UploadCode = "encounter-support"
|
||||
UcEnOther UploadCode = "encounter-other"
|
||||
UCSEP UploadCode = "vclaim-sep" // SEP
|
||||
UCSIPP UploadCode = "vclaim-sipp" // SIPP
|
||||
DTCPRN DocTypeCode = "person-resident-number" // Person Resident Number
|
||||
DTCPDL DocTypeCode = "person-driver-license" // Person Driver License
|
||||
DTCPP DocTypeCode = "person-passport" // Person Passport
|
||||
DTCPFC DocTypeCode = "person-family-card" // Person Family Card
|
||||
DTCMIR DocTypeCode = "mcu-item-result" // Mcu Item Result
|
||||
DTCEnPatient DocTypeCode = "encounter-patient"
|
||||
DTCEnSupport DocTypeCode = "encounter-support"
|
||||
DTCEnOther DocTypeCode = "encounter-other"
|
||||
DTCSEP DocTypeCode = "vclaim-sep" // SEP
|
||||
DTCSIPP DocTypeCode = "vclaim-sipp" // SIPP
|
||||
DTCGC DocTypeCode = "general-consent"
|
||||
|
||||
ETCPerson EntityTypeCode = "person"
|
||||
ETCEncounter EntityTypeCode = "encounter"
|
||||
ETCMCU EntityTypeCode = "mcu"
|
||||
)
|
||||
|
||||
var validUploadCodesByEntity = map[EntityTypeCode][]UploadCode{
|
||||
var validUploadCodesByEntity = map[EntityTypeCode][]DocTypeCode{
|
||||
ETCPerson: {
|
||||
UCPRN, UCPDL, UCPP, UCPFC,
|
||||
DTCPRN, DTCPDL, DTCPP, DTCPFC,
|
||||
},
|
||||
ETCEncounter: {
|
||||
UCSEP, UCSIPP, UCEnPatient, UCEnSupport, UcEnOther,
|
||||
DTCSEP, DTCSIPP, DTCEnPatient, DTCEnSupport, DTCEnOther,
|
||||
},
|
||||
ETCMCU: {
|
||||
UCMIR,
|
||||
DTCMIR,
|
||||
},
|
||||
}
|
||||
|
||||
func IsValidUploadCode(entity EntityTypeCode, code UploadCode) (bool, string) {
|
||||
func IsValidUploadCode(entity EntityTypeCode, code DocTypeCode) (bool, string) {
|
||||
allowedCodes, ok := validUploadCodesByEntity[entity]
|
||||
if !ok {
|
||||
return false, fmt.Sprintf("unknown entityType_code: %s", entity)
|
||||
@@ -48,5 +49,5 @@ func IsValidUploadCode(entity EntityTypeCode, code UploadCode) (bool, string) {
|
||||
}
|
||||
}
|
||||
|
||||
return false, fmt.Sprintf("invalid upload_code '%s' for entityType_code '%s'", code, entity)
|
||||
return false, fmt.Sprintf("invalid doctype_code '%s' for entityType_code '%s'", code, entity)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user