Skip to content

Commit

Permalink
Prevent upload of metadata if it already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
tcezard committed Oct 2, 2024
1 parent 5c99a98 commit 41f5c98
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ public ResponseEntity<?> markSubmissionUploaded(@RequestHeader("Authorization")
return new ResponseEntity<>("Unauthorized", HttpStatus.UNAUTHORIZED);
}

submissionService.checkMetadataFileInfoMatchesWithUploadedFiles(submissionAccount, submissionId, metadataJson);
String submissionStatus = submissionService.getSubmissionStatus(submissionId);
if (! Objects.equals(submissionStatus, SubmissionStatus.OPEN.toString())){
return new ResponseEntity<>(
"Submission " + submissionId + "is not in status " + SubmissionStatus.OPEN +
" so cannot be marked as " + SubmissionStatus.UPLOADED +
"Current Status: " + submissionStatus,
HttpStatus.BAD_REQUEST);
}
try {
submissionService.checkMetadataFileInfoMatchesWithUploadedFiles(submissionAccount, submissionId, metadataJson);
Submission submission = this.submissionService.uploadMetadataJsonAndMarkUploaded(submissionId, metadataJson);
Expand Down

0 comments on commit 41f5c98

Please sign in to comment.