Skip to content

Commit

Permalink
Merge pull request #3840 from nationalarchives/master
Browse files Browse the repository at this point in the history
Update Play Framework to v3
  • Loading branch information
Tom-Hallett authored Apr 12, 2024
2 parents cc1a5fc + ea6d3be commit 95ee0f3
Show file tree
Hide file tree
Showing 10 changed files with 859 additions and 1,032 deletions.
2 changes: 2 additions & 0 deletions app/configuration/ApplicationConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class ApplicationConfig @Inject() (configuration: Configuration) {

val blockDraftMetadataUpload: Boolean = configuration.get[Boolean]("featureAccessBlock.blockDraftMetadataUpload")

val blockAutomateJudgmentTransfers: Boolean = configuration.get[Boolean]("featureAccessBlock.blockAutomateJudgmentTransfers")

val metadataValidationBaseUrl: String = configuration.get[String]("metadatavalidation.baseUrl")

val s3Endpoint: String = configuration.get[String]("s3.endpoint")
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/ConfirmTransferController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ class ConfirmTransferController @Inject() (
}
} yield res
}

def judgmentChecksPassedSubmit(consignmentId: UUID): Action[AnyContent] = finalJudgmentTransferConfirmationSubmit(consignmentId: UUID)

}

case class ConsignmentSummaryData(seriesCode: String, transferringBody: String, totalFiles: Int, consignmentReference: String)
Expand Down
17 changes: 11 additions & 6 deletions app/controllers/FileChecksResultsController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class FileChecksResultsController @Inject() (

def judgmentFileCheckResultsPage(consignmentId: UUID): Action[AnyContent] = judgmentTypeAction(consignmentId) { implicit request: Request[AnyContent] =>
val pageTitle = "Results of checks"
val blockAutomateJudgmentTransfers = applicationConfig.blockAutomateJudgmentTransfers
for {
consignmentStatuses <- consignmentStatusService.getConsignmentStatuses(consignmentId, request.token.bearerAccessToken)
reference <- consignmentService.getConsignmentRef(consignmentId, request.token.bearerAccessToken)
Expand All @@ -69,12 +70,16 @@ class FileChecksResultsController @Inject() (
fileCheck <- consignmentService.getConsignmentFileChecks(consignmentId, request.token.bearerAccessToken)
result <-
if (fileCheck.allChecksSucceeded) {
consignmentService
.getConsignmentFilesData(consignmentId, request.token.bearerAccessToken)
.flatMap(files => {
val filename = files.files.head.metadata.clientSideOriginalFilePath.get
Future(Ok(views.html.judgment.judgmentFileChecksResults(filename, pageTitle, consignmentId, reference, request.token.name)).uncache())
})
if (blockAutomateJudgmentTransfers) {
consignmentService
.getConsignmentFilesData(consignmentId, request.token.bearerAccessToken)
.flatMap(files => {
val filename = files.files.head.metadata.clientSideOriginalFilePath.get
Future(Ok(views.html.judgment.judgmentFileChecksResults(filename, pageTitle, consignmentId, reference, request.token.name)).uncache())
})
} else {
Future(Redirect(routes.ConfirmTransferController.judgmentChecksPassedSubmit(consignmentId)).uncache())
}
} else {
Future(Ok(views.html.fileChecksResultsFailed(request.token.name, pageTitle, reference, isJudgmentUser = true)).uncache())
}
Expand Down
1 change: 1 addition & 0 deletions conf/application.base.conf
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ draft_metadata_s3_bucket_name = ${DRAFT_METADATA_S3_BUCKET_NAME}

featureAccessBlock {
blockDraftMetadataUpload=${BLOCK_DRAFT_METADATA_UPLOAD}
blockAutomateJudgmentTransfers=${BLOCK_AUTOMATE_JUDGMENT_TRANSFERS}
}
1 change: 1 addition & 0 deletions conf/application.local-base.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ draft_metadata_s3_bucket_name = "tdr-draft-metadata-intg"

featureAccessBlock {
blockDraftMetadataUpload=false
blockAutomateJudgmentTransfers=false
}
1 change: 1 addition & 0 deletions conf/routes
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@ GET /judgment/:consignmentId/file-checks
POST /judgment/:consignmentId/file-check-progress controllers.FileChecksController.fileCheckProgress(consignmentId: java.util.UUID)
GET /judgment/:consignmentId/file-checks-results controllers.FileChecksResultsController.judgmentFileCheckResultsPage(consignmentId: java.util.UUID)
POST /judgment/:consignmentId/file-checks-results controllers.ConfirmTransferController.finalJudgmentTransferConfirmationSubmit(consignmentId: java.util.UUID)
GET /judgment/:consignmentId/checks-passed controllers.ConfirmTransferController.judgmentChecksPassedSubmit(consignmentId: java.util.UUID)
GET /judgment/:consignmentId/transfer-complete controllers.TransferCompleteController.judgmentTransferComplete(consignmentId: java.util.UUID)
Loading

0 comments on commit 95ee0f3

Please sign in to comment.