diff --git a/src/main/java/uk/ac/ebi/eva/submission/controller/submissionws/SubmissionController.java b/src/main/java/uk/ac/ebi/eva/submission/controller/submissionws/SubmissionController.java index 1331ca1..646f3be 100644 --- a/src/main/java/uk/ac/ebi/eva/submission/controller/submissionws/SubmissionController.java +++ b/src/main/java/uk/ac/ebi/eva/submission/controller/submissionws/SubmissionController.java @@ -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);