From 16cef98e36f073fda88375e741ed87f7737456fc Mon Sep 17 00:00:00 2001 From: Roberto Tyley <52038+rtyley@users.noreply.github.com> Date: Thu, 25 Jul 2024 15:44:15 +0100 Subject: [PATCH] WIP: Upgrade to Scala 2.13 --- build.sbt | 6 +++--- .../lib/metadata/SoftDeletedMetadataTable.scala | 2 -- image-loader/app/controllers/ImageLoaderController.scala | 2 +- image-loader/app/controllers/UploadStatusController.scala | 1 + image-loader/app/lib/UploadStatusTable.scala | 6 ++++-- leases/app/lib/LeaseStore.scala | 1 - 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build.sbt b/build.sbt index 255ff130cd..62c961967f 100644 --- a/build.sbt +++ b/build.sbt @@ -15,7 +15,7 @@ import com.typesafe.sbt.packager.debian.JDebPackaging ThisBuild / packageOptions += FixedTimestamp(Package.keepTimestamps) val commonSettings = Seq( - scalaVersion := "2.12.20", + scalaVersion := "2.13.15", description := "grid", organization := "com.gu", version := "0.1", @@ -142,7 +142,7 @@ lazy val mediaApi = playProject("media-api", 9001) .settings( libraryDependencies ++= Seq( "org.apache.commons" % "commons-email" % "1.5", - "org.parboiled" %% "parboiled" % "2.1.5", + "org.parboiled" %% "parboiled" % "2.5.1", "org.http4s" %% "http4s-core" % "0.23.17", ) ) @@ -166,7 +166,7 @@ lazy val usage = playProject("usage", 9009).settings( libraryDependencies ++= Seq( "com.gu" %% "content-api-client-default" % "19.0.4", "com.gu" %% "content-api-client-aws" % "0.7", - "io.reactivex" %% "rxscala" % "0.26.5", + "io.reactivex" %% "rxscala" % "0.27.0", "com.amazonaws" % "amazon-kinesis-client" % "1.8.10", "com.google.protobuf" % "protobuf-java" % "3.19.6" ) diff --git a/common-lib/src/main/scala/com/gu/mediaservice/lib/metadata/SoftDeletedMetadataTable.scala b/common-lib/src/main/scala/com/gu/mediaservice/lib/metadata/SoftDeletedMetadataTable.scala index c9fe6b827a..b52adee869 100644 --- a/common-lib/src/main/scala/com/gu/mediaservice/lib/metadata/SoftDeletedMetadataTable.scala +++ b/common-lib/src/main/scala/com/gu/mediaservice/lib/metadata/SoftDeletedMetadataTable.scala @@ -5,8 +5,6 @@ import com.gu.mediaservice.lib.config.CommonConfig import com.gu.mediaservice.model.ImageStatusRecord import org.scanamo._ import org.scanamo.syntax._ -import org.scanamo.generic.auto._ -import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient import scala.concurrent.{ExecutionContext, Future} import scala.jdk.CollectionConverters.collectionAsScalaIterableConverter diff --git a/image-loader/app/controllers/ImageLoaderController.scala b/image-loader/app/controllers/ImageLoaderController.scala index 0f3a97c33a..649907388b 100644 --- a/image-loader/app/controllers/ImageLoaderController.scala +++ b/image-loader/app/controllers/ImageLoaderController.scala @@ -21,7 +21,7 @@ import com.gu.mediaservice.lib.logging.{FALLBACK, LogMarker, MarkerMap} import com.gu.mediaservice.lib.play.RequestLoggingFilter import com.gu.mediaservice.lib.{DateTimeUtils, ImageIngestOperations} import com.gu.mediaservice.model.{UnsupportedMimeTypeException, UploadInfo} -import org.scanamo.{ConditionNotMet, ScanamoError} +import org.scanamo.error.{ConditionNotMet, ScanamoError} import lib.FailureResponse.Response import lib.imaging.{MimeTypeDetection, NoSuchImageExistsInS3, UserImageLoaderException} import lib.storage.{ImageLoaderStore, S3FileDoesNotExistException} diff --git a/image-loader/app/controllers/UploadStatusController.scala b/image-loader/app/controllers/UploadStatusController.scala index 4bde0c8b3b..ad243188e4 100644 --- a/image-loader/app/controllers/UploadStatusController.scala +++ b/image-loader/app/controllers/UploadStatusController.scala @@ -3,6 +3,7 @@ package controllers import com.gu.mediaservice.lib.argo.ArgoHelpers import com.gu.mediaservice.lib.auth._ +import org.scanamo.error.{ConditionNotMet, DynamoReadError, ScanamoError} import lib._ import model.{StatusType, UploadStatus} import org.scanamo.{ConditionNotMet, ScanamoError} diff --git a/image-loader/app/lib/UploadStatusTable.scala b/image-loader/app/lib/UploadStatusTable.scala index c06d51da4c..8b82556c52 100644 --- a/image-loader/app/lib/UploadStatusTable.scala +++ b/image-loader/app/lib/UploadStatusTable.scala @@ -1,8 +1,10 @@ package lib +import com.gu.mediaservice.lib.aws.DynamoDB import org.scanamo._ +import org.scanamo.error.DynamoReadError +import org.scanamo.query.{AndCondition, AttributeExists, Condition, ConditionExpression, KeyEquals} import org.scanamo.syntax._ -import org.scanamo.generic.auto._ import model.StatusType.{Prepared, Queued} import model.{UploadStatus, UploadStatusRecord} import software.amazon.awssdk.services.dynamodb.{DynamoDbAsyncClient, DynamoDbAsyncClientBuilder} @@ -17,7 +19,7 @@ class UploadStatusTable(config: ImageLoaderConfig) { private val uploadStatusTable = Table[UploadStatusRecord](config.uploadStatusTable) def getStatus(imageId: String) = { - scanamo.exec(uploadStatusTable.get("id" === imageId)) + ScanamoAsync(client)(uploadStatusTable.get('id -> imageId)) } def setStatus(uploadStatus: UploadStatusRecord) = { diff --git a/leases/app/lib/LeaseStore.scala b/leases/app/lib/LeaseStore.scala index 3e08a5f126..216e9f63d5 100644 --- a/leases/app/lib/LeaseStore.scala +++ b/leases/app/lib/LeaseStore.scala @@ -3,7 +3,6 @@ package lib import com.gu.mediaservice.model.leases.{MediaLease, MediaLeaseType} import org.scanamo._ import org.scanamo.syntax._ -import org.scanamo.generic.auto._ import org.joda.time.DateTime import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient