Skip to content

Commit

Permalink
Re-order Dynamo format derivers to avoid warnings
Browse files Browse the repository at this point in the history
```
[warn] /Users/david_furey/code/facia-tool/app/controllers/UserDataController.scala:23:69: Reference to uninitialized value Trail
[warn]   implicit val UserData: DynamoFormat[UserData] = deriveDynamoFormat[UserData]
[warn]                                                                     ^
[warn] /Users/david_furey/code/facia-tool/app/controllers/UserDataController.scala:24:63: Reference to uninitialized value JsValue
[warn]   implicit val Trail: DynamoFormat[Trail] = deriveDynamoFormat[Trail]
[warn]                                                               ^
[warn] two warnings found
```
  • Loading branch information
davidfurey committed May 8, 2024
1 parent c6c2cd7 commit 45bc4fd
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/controllers/UserDataController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@ import org.scanamo.generic.semiauto._
import scala.util.{Failure, Success, Try}

class UserDataController(frontsApi: FrontsApi, dynamoClient: DynamoDbClient, val deps: BaseFaciaControllerComponents)(implicit ec: ExecutionContext) extends BaseFaciaController(deps) {
implicit val UserData: DynamoFormat[UserData] = deriveDynamoFormat[UserData]
implicit val Trail: DynamoFormat[Trail] = deriveDynamoFormat[Trail]
implicit val JsValue: DynamoFormat[JsValue] = DynamoFormat.xmap[JsValue, String](
implicit val jsValue: DynamoFormat[JsValue] = DynamoFormat.xmap[JsValue, String](
x => Try(Json.parse(x)) match {
case Success(y) => Right(y)
case Failure(t) => Left(TypeCoercionError(t))
},
x => (Json.stringify(x))
)

implicit val trail: DynamoFormat[Trail] = deriveDynamoFormat[Trail]
implicit val userData: DynamoFormat[UserData] = deriveDynamoFormat[UserData]
private lazy val userDataTable = Table[UserData](config.faciatool.userDataTable)

private def updateClipboardContentByFieldName(articles: Option[JsValue], userEmail: String, fieldName: String) = {
Expand Down

0 comments on commit 45bc4fd

Please sign in to comment.