Skip to content

Commit

Permalink
Bug on last update
Browse files Browse the repository at this point in the history
  • Loading branch information
larousso committed Oct 14, 2024
1 parent 3d7780f commit c8cef5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion nio-server/app/models/ConsentFact.scala
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ case class PartialConsentFact(
userId: Option[String] = None,
doneBy: Option[DoneBy] = None,
version: Option[Int] = None,
lastUpdate: Option[LocalDateTime] = None,
lastUpdate: Option[LocalDateTime] = Some(LocalDateTime.now(Clock.systemUTC)),
groups: Option[Seq[PartialConsentGroup]] = None,
offers: Option[Seq[PartialConsentOffer]] = None,
orgKey: Option[String] = None,
Expand Down
11 changes: 7 additions & 4 deletions nio-server/test/controllers/ConsentControllerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -818,10 +818,13 @@ class ConsentControllerSpec extends TestUtils {
"Partial update on consent" in {
val organisationKey: String = "maif"

val path: String =
s"/$tenant/organisations/$organisationKey/users/$userId1"
val putResponse = putJson(path, user1AsJson)
val userId = userId1 + "1"
val user = user1.copy(userId = userId)

val path: String = s"/$tenant/organisations/$organisationKey/users/$userId"
val putResponse = putJson(path, user.asJson())

println(putResponse.json)
putResponse.status mustBe OK

val patchResponse = patchJson(path, Json.obj(
Expand All @@ -840,7 +843,7 @@ class ConsentControllerSpec extends TestUtils {
patchResponse.status mustBe OK

val expectedDate: LocalDateTime = (json \ "lastUpdate").validate(DateUtils.utcDateTimeReads).get
json mustBe user1.copy(
json mustBe user.copy(
orgKey = Some("maif"),
lastUpdate = expectedDate,
groups = user1.groups.updated(0, user1.groups(0).copy(
Expand Down

0 comments on commit c8cef5c

Please sign in to comment.