From 8b7682cbb56dce77f123b0504e2f9565edd2643c Mon Sep 17 00:00:00 2001 From: Yurii Shynbuiev Date: Tue, 24 Oct 2023 16:32:27 +0700 Subject: [PATCH] fix(pollux): add asc ordering to the VerificationPolicy constraints ATL-6040 Signed-off-by: Yurii Shynbuiev --- .../iohk/atala/pollux/sql/model/db/VerificationPolicy.scala | 4 +++- .../pollux/sql/VerificationPolicySqlIntegrationSpec.scala | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pollux/lib/sql-doobie/src/main/scala/io/iohk/atala/pollux/sql/model/db/VerificationPolicy.scala b/pollux/lib/sql-doobie/src/main/scala/io/iohk/atala/pollux/sql/model/db/VerificationPolicy.scala index b64bd515b1..fbc8120a2c 100644 --- a/pollux/lib/sql-doobie/src/main/scala/io/iohk/atala/pollux/sql/model/db/VerificationPolicy.scala +++ b/pollux/lib/sql-doobie/src/main/scala/io/iohk/atala/pollux/sql/model/db/VerificationPolicy.scala @@ -75,7 +75,9 @@ object VerificationPolicySql extends DoobieContext.Postgres(SnakeCase) { def getVerificationPolicyConstrains(fk_ids: Seq[UUID]) = run( quote( - query[VerificationPolicyConstraint].filter(vpc => liftQuery(fk_ids).contains(vpc.fk_id)) + query[VerificationPolicyConstraint] + .filter(vpc => liftQuery(fk_ids).contains(vpc.fk_id)) + .sortBy(_.index)(Ord.asc) ) ) diff --git a/pollux/lib/sql-doobie/src/test/scala/io/iohk/atala/pollux/sql/VerificationPolicySqlIntegrationSpec.scala b/pollux/lib/sql-doobie/src/test/scala/io/iohk/atala/pollux/sql/VerificationPolicySqlIntegrationSpec.scala index fb75706797..665815dc2e 100644 --- a/pollux/lib/sql-doobie/src/test/scala/io/iohk/atala/pollux/sql/VerificationPolicySqlIntegrationSpec.scala +++ b/pollux/lib/sql-doobie/src/test/scala/io/iohk/atala/pollux/sql/VerificationPolicySqlIntegrationSpec.scala @@ -286,7 +286,7 @@ object VerificationPolicySqlIntegrationSpec extends ZIOSpecDefault, PostgresTest name <- name description <- description constraints <- Gen - .setOfBounded(min = 1, max = 10)(verificationPolicyConstraint) + .setOfBounded(min = 2, max = 10)(verificationPolicyConstraint) .map(_.toVector) } yield VerificationPolicy.make( name = name,