Skip to content

perf(teams): batch ownership checks in LegacyRemoveMemberService#28778

Draft
diogeneszilli wants to merge 1 commit intocalcom:mainfrom
diogeneszilli:perf/teams-batch-ownership-checks
Draft

perf(teams): batch ownership checks in LegacyRemoveMemberService#28778
diogeneszilli wants to merge 1 commit intocalcom:mainfrom
diogeneszilli:perf/teams-batch-ownership-checks

Conversation

@diogeneszilli
Copy link
Copy Markdown

Summary

  • Replace nested Promise.all().map() calling isTeamOwner() per member per team (M×T×2 queries) with a single membership.findMany() batch query
  • Build an in-memory Set for O(1) ownership lookups instead of repeated DB round-trips

Test plan

  • Verify that non-owners cannot remove team owners
  • Verify that owners cannot remove themselves from teams they own
  • Verify org admins bypass ownership checks as before
  • Run yarn type-check:ci --force to confirm no type regressions

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants