Skip to content

Commit

Permalink
Merge pull request #3359 from nationalarchives/TDR-3429-update-graphq…
Browse files Browse the repository at this point in the history
…l-queries

Tdr 3429 update graphql queries
  • Loading branch information
vimleshtna authored Oct 10, 2023
2 parents 9169244 + 6e4166b commit ff04de3
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/controllers/ConfirmTransferController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ConfirmTransferController @Inject() (
consignmentService
.getConsignmentConfirmTransfer(consignmentId, request.token.bearerAccessToken)
.map { summary =>
ConsignmentSummaryData(summary.series.get.code, summary.transferringBody.get.name, summary.totalFiles, summary.consignmentReference)
ConsignmentSummaryData(summary.seriesName.get, summary.transferringBodyName.get, summary.totalFiles, summary.consignmentReference)
}
}

Expand Down
3 changes: 1 addition & 2 deletions app/controllers/SeriesDetailsController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ class SeriesDetailsController @Inject() (
result <- seriesStatus match {
case Some(CompletedValue.value) =>
val seriesOption: InputNameAndValue = consignmentStatus
.flatMap(_.series)
.map(series => InputNameAndValue(series.code, series.seriesid.toString))
.map(c => InputNameAndValue(c.seriesName.getOrElse(""), c.seriesid.getOrElse("").toString))
.get

Future(
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ libraryDependencies ++= Seq(
"com.softwaremill.sttp.client" %% "async-http-client-backend-future" % sttpVersion,
"uk.gov.nationalarchives" %% "tdr-graphql-client" % "0.0.132",
"uk.gov.nationalarchives" %% "tdr-auth-utils" % "0.0.168",
"uk.gov.nationalarchives" %% "tdr-generated-graphql" % "0.0.349",
"uk.gov.nationalarchives" %% "tdr-generated-graphql" % "0.0.350",
"com.github.tototoshi" %% "scala-csv" % "1.3.10",
"ch.qos.logback" % "logback-classic" % "1.4.11",
ws,
Expand Down
8 changes: 4 additions & 4 deletions test/controllers/ConfirmTransferControllerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class ConfirmTransferControllerSpec extends FrontEndTestHelper {

confirmTransferPageAsString must include(
s""" <dd class="govuk-summary-list__value">
| ${consignmentSummaryResponse.series.get.code}
| ${consignmentSummaryResponse.seriesName.get}
| </dd>""".stripMargin
)

Expand All @@ -137,7 +137,7 @@ class ConfirmTransferControllerSpec extends FrontEndTestHelper {

confirmTransferPageAsString must include(
s""" <dd class="govuk-summary-list__value">
| ${consignmentSummaryResponse.transferringBody.get.name}
| ${consignmentSummaryResponse.transferringBodyName.get}
| </dd>""".stripMargin
)

Expand Down Expand Up @@ -676,8 +676,8 @@ class ConfirmTransferControllerSpec extends FrontEndTestHelper {
}

private def getConsignmentSummaryResponse: gcs.GetConsignment = {
val seriesCode = Some(gcs.GetConsignment.Series("Mock Series 2"))
val transferringBodyName = Some(gcs.GetConsignment.TransferringBody("MockBody 2"))
val seriesCode = Some("Mock Series 2")
val transferringBodyName = Some("MockBody 2")
val totalFiles: Int = 4
val consignmentReference = "TEST-TDR-2021-GB"
new gcs.GetConsignment(seriesCode, transferringBodyName, totalFiles, consignmentReference)
Expand Down
1 change: 1 addition & 0 deletions test/services/ConsignmentStatusServiceSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class ConsignmentStatusServiceSpec extends AnyWordSpec with MockitoSugar with Be
gcs.Data(
Option(
gcs.GetConsignment(
None,
None,
statuses
)
Expand Down
7 changes: 4 additions & 3 deletions test/testUtils/FrontEndTestHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ import graphql.codegen.GetAllDescendants.getAllDescendantIds
import graphql.codegen.GetAllDescendants.getAllDescendantIds.AllDescendants
import graphql.codegen.GetConsignmentFilesMetadata.getConsignmentFilesMetadata.GetConsignment.Files.{FileMetadata, FileStatuses}
import graphql.codegen.GetConsignmentFilesMetadata.{getConsignmentFilesMetadata => gcfm}
import graphql.codegen.GetConsignmentStatus.getConsignmentStatus.GetConsignment
import graphql.codegen.GetConsignmentFiles.{getConsignmentFiles => gcf}
import graphql.codegen.GetConsignmentStatus.getConsignmentStatus.GetConsignment.{ConsignmentStatuses, Series}
import graphql.codegen.GetConsignmentStatus.getConsignmentStatus.GetConsignment.ConsignmentStatuses
import graphql.codegen.GetConsignmentStatus.{getConsignmentStatus => gcs}
import graphql.codegen.GetConsignments.getConsignments.Consignments
import graphql.codegen.GetConsignments.getConsignments.Consignments.Edges
Expand Down Expand Up @@ -69,6 +68,7 @@ import play.api.{Application, Configuration}
import uk.gov.nationalarchives.tdr.GraphQLClient
import uk.gov.nationalarchives.tdr.keycloak.Token
import graphql.codegen.GetConsignment.{getConsignment => gcd}
import graphql.codegen.GetConsignmentStatus.getConsignmentStatus.GetConsignment
import services.Statuses.{InProgressValue, SeriesType}
import viewsapi.FrontEndInfo

Expand Down Expand Up @@ -242,7 +242,8 @@ trait FrontEndTestHelper extends PlaySpec with MockitoSugar with Injecting with
val consignmentResponse = gcs.Data(
Option(
GetConsignment(
Some(Series(seriesId.getOrElse(UUID.randomUUID()), "MOCK1")),
seriesId,
Some("MOCK1"),
consignmentStatuses
)
)
Expand Down

0 comments on commit ff04de3

Please sign in to comment.