Skip to content

Commit

Permalink
Convert result upload error type enum values to snake case
Browse files Browse the repository at this point in the history
  • Loading branch information
nathancrtr committed Jul 11, 2023
1 parent 586f23e commit 4e11732
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ private List<FeedbackMessage> validateDeviceModelAndTestPerformedCode(
.fieldRequired(true)
.fieldHeader(EQUIPMENT_MODEL_NAME)
.errorType(ResultUploadErrorType.INVALID_DATA)
.source(ResultUploadErrorSource.SIMPLEREPORT)
.source(ResultUploadErrorSource.SIMPLE_REPORT)
.build());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package gov.cdc.usds.simplereport.db.model.auxiliary;

public enum ResultUploadErrorSource {
REPORTSTREAM,
SIMPLEREPORT,
REPORT_STREAM,
SIMPLE_REPORT,
}
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ private TestResultUpload saveSubmissionToDb(

if (response.getErrors() != null && response.getErrors().length > 0) {
for (var error : response.getErrors()) {
error.setSource(ResultUploadErrorSource.REPORTSTREAM);
error.setSource(ResultUploadErrorSource.REPORT_STREAM);
}

errorRepository.saveAll(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public static List<FeedbackMessage> validateSpecimenType(
.scope(ITEM_SCOPE)
.message(getInValidValueErrorMessage(input.getValue(), input.getHeader()))
.errorType(ResultUploadErrorType.INVALID_DATA)
.source(ResultUploadErrorSource.SIMPLEREPORT)
.source(ResultUploadErrorSource.SIMPLE_REPORT)
.fieldRequired(true)
.fieldHeader(input.getHeader())
.build());
Expand All @@ -201,7 +201,7 @@ public static List<FeedbackMessage> validateSpecimenType(
.scope(ITEM_SCOPE)
.message(getInValidValueErrorMessage(input.getValue(), input.getHeader()))
.errorType(ResultUploadErrorType.INVALID_DATA)
.source(ResultUploadErrorSource.SIMPLEREPORT)
.source(ResultUploadErrorSource.SIMPLE_REPORT)
.fieldRequired(true)
.fieldHeader(input.getHeader())
.build());
Expand Down Expand Up @@ -277,7 +277,7 @@ public static List<FeedbackMessage> validateFlexibleDate(ValueOrError input) {
.fieldHeader(input.getHeader())
.message(getInValidValueErrorMessage(input.getValue(), input.getHeader()))
.errorType(ResultUploadErrorType.INVALID_DATA)
.source(ResultUploadErrorSource.SIMPLEREPORT)
.source(ResultUploadErrorSource.SIMPLE_REPORT)
.fieldRequired(input.isRequired())
.build());
}
Expand Down Expand Up @@ -318,7 +318,7 @@ public static ValueOrError getValue(Map<String, String> row, String name, boolea
.scope(ITEM_SCOPE)
.fieldHeader(name)
.message(getRequiredValueErrorMessage(name))
.source(ResultUploadErrorSource.SIMPLEREPORT)
.source(ResultUploadErrorSource.SIMPLE_REPORT)
.errorType(ResultUploadErrorType.MISSING_DATA)
.fieldRequired(true)
.build());
Expand All @@ -340,7 +340,7 @@ public static List<FeedbackMessage> hasMissingRequiredHeaders(
.scope(CsvValidatorUtils.ITEM_SCOPE)
.message(
"The header for column " + requiredField + " is missing or invalid.")
.source(ResultUploadErrorSource.SIMPLEREPORT)
.source(ResultUploadErrorSource.SIMPLE_REPORT)
.fieldHeader(requiredField)
.errorType(ResultUploadErrorType.MISSING_HEADER)
.fieldRequired(true)
Expand Down Expand Up @@ -449,7 +449,7 @@ private static List<FeedbackMessage> validateRegex(ValueOrError input, String re
FeedbackMessage.builder()
.scope(ITEM_SCOPE)
.fieldHeader(input.getHeader())
.source(ResultUploadErrorSource.SIMPLEREPORT)
.source(ResultUploadErrorSource.SIMPLE_REPORT)
.message(getInValidValueErrorMessage(input.getValue(), input.getHeader()))
.errorType(ResultUploadErrorType.INVALID_DATA)
.fieldRequired(input.isRequired())
Expand All @@ -471,7 +471,7 @@ private static List<FeedbackMessage> validateInSet(
.scope(ITEM_SCOPE)
.fieldHeader(input.getHeader())
.message(getInValidValueErrorMessage(input.getValue(), input.getHeader()))
.source(ResultUploadErrorSource.SIMPLEREPORT)
.source(ResultUploadErrorSource.SIMPLE_REPORT)
.errorType(ResultUploadErrorType.INVALID_DATA)
.fieldRequired(input.isRequired())
.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public List<FeedbackMessage> validate(InputStream csvStream) {
FeedbackMessage.builder()
.scope(CsvValidatorUtils.ITEM_SCOPE)
.message("File is missing headers and other required data")
.source(ResultUploadErrorSource.SIMPLEREPORT)
.source(ResultUploadErrorSource.SIMPLE_REPORT)
.build();
mergeErrors(mapOfErrors, new ArrayList<>(List.of(feedback)));
}
Expand All @@ -57,7 +57,7 @@ public List<FeedbackMessage> validate(InputStream csvStream) {
.message(
"File has the incorrect number of columns or empty rows. Please make sure all columns match the data template, and delete any empty rows.")
.indices(new ArrayList<>(List.of(rowNumber)))
.source(ResultUploadErrorSource.SIMPLEREPORT)
.source(ResultUploadErrorSource.SIMPLE_REPORT)
.build();
mergeErrors(mapOfErrors, new ArrayList<>(List.of(feedback)));
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4738,7 +4738,7 @@ databaseChangeLog:
- sql:
remarks: Create the enumerations for upload error sources
sql: |
CREATE TYPE ${database.defaultSchemaName}.RESULT_UPLOAD_ERROR_SOURCE as ENUM('SIMPLEREPORT', 'REPORTSTREAM');
CREATE TYPE ${database.defaultSchemaName}.RESULT_UPLOAD_ERROR_SOURCE as ENUM('SIMPLE_REPORT', 'REPORT_STREAM');
- createTable:
tableName: result_upload_error
remarks: A collection of errors for bulk upload submission attempts.
Expand Down

0 comments on commit 4e11732

Please sign in to comment.