rename and adjust upload code into doctypecode
This commit is contained in:
@@ -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