Skip to content

Commit

Permalink
re-denormalize study.uids when propagating broadcast members
Browse files Browse the repository at this point in the history
closes #16177
  • Loading branch information
ornicar committed Oct 6, 2024
1 parent cfbc85b commit 969ea01
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions modules/study/src/main/StudyRepo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,16 @@ final class StudyRepo(private[study] val coll: AsyncColl)(using
coll(_.primitiveOne[Bdoc]($id(id), "members"))

def setMembersDoc(ids: Seq[StudyId], members: Bdoc): Funit =
coll(_.update.one($inIds(ids), $set("members" -> members), multi = true)).void

def uids(studyId: StudyId): Fu[Set[UserId]] =
coll(_.primitiveOne[Set[UserId]]($id(studyId), F.uids)).dmap(~_)
coll(
_.update.one(
$inIds(ids),
$set(
"members" -> members,
"uids" -> members.toMap.keys
),
multi = true
)
).void

private val idNameProjection = $doc("name" -> true)

Expand Down

0 comments on commit 969ea01

Please sign in to comment.