diff --git a/dynamodb/src/it/scala/zio/dynamodb/TypeSafeApiAlternateModeling.scala b/dynamodb/src/it/scala/zio/dynamodb/TypeSafeApiAlternateModeling.scala index 702543d0..6cb11571 100644 --- a/dynamodb/src/it/scala/zio/dynamodb/TypeSafeApiAlternateModeling.scala +++ b/dynamodb/src/it/scala/zio/dynamodb/TypeSafeApiAlternateModeling.scala @@ -66,7 +66,7 @@ object TypeSafeApiAlternateModeling extends DynamoDBLocalSpec { object Contract { implicit val schema: Schema.CaseClass5[String, Option[String], Option[String], Boolean, ContractBody, Contract] = DeriveSchema.gen[Contract] - val (id, identityId, accountId, isTest, body) = ProjectionExpression.accessors[Contract] + val (id, alternateId, accountId, isTest, body) = ProjectionExpression.accessors[Contract] } } diff --git a/dynamodb/src/it/scala/zio/dynamodb/TypeSafeApiSingleTableSpec.scala b/dynamodb/src/it/scala/zio/dynamodb/TypeSafeApiSingleTableSpec.scala index 0f5efa3e..48e50ee8 100644 --- a/dynamodb/src/it/scala/zio/dynamodb/TypeSafeApiSingleTableSpec.scala +++ b/dynamodb/src/it/scala/zio/dynamodb/TypeSafeApiSingleTableSpec.scala @@ -11,13 +11,14 @@ import java.time.Instant import zio.schema.annotation.discriminatorName import zio.ZIO -/** Demonstrates how to implement the single table pattern (also known as the adjacency lists pattern) using the type-safe API. - * see https://www.alexdebrie.com/posts/dynamodb-single-table/ - * see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-adjacency-graphs.html - */ +/** + * Demonstrates how to implement the single table pattern (also known as the adjacency lists pattern) using the type-safe API + * using sum and product types. + * see https://www.alexdebrie.com/posts/dynamodb-single-table/ + * see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-adjacency-graphs.html + */ object TypeSafeApiSingleTableSpec extends DynamoDBLocalSpec { - @discriminatorName("userBodyType") sealed trait UserBody object UserBody { @@ -45,7 +46,7 @@ object TypeSafeApiSingleTableSpec extends DynamoDBLocalSpec { val (id, selector, userBody) = ProjectionExpression.accessors[User] // smart constructors manage the id and sort keys - + def makeProfile(username: String, fullName: String, email: String, createdAt: Instant): User = User(s"USER#$username", s"Profile#$username", UserBody.Profile(username, fullName, email, createdAt))