-
Notifications
You must be signed in to change notification settings - Fork 768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed fetching organization data aggregates when segments are enabled #1420
Conversation
…n fetching organization
Hey @themarolt, Is there a benefit in changing the behavior based on the feature flag like in this PR? |
We have already this iffed behaviour on member query and organization query endpoint and where we index documents to OpenSearch. This is because we only allow filtering by one segment id (1 leaf or 1 parent or 1 grandparent one) and it's provided as a filter from the frontend. This is because of how OpenSearch works and how we can't really filter on aggregated data - so we pre-build and index aggregated documents for each leaf segment and each parent segment and each grandparent segment. This means that you can't currently filter members/organizations by for example 2 leaf segment ids and 1 parent segment id because there is no such document in the index that has aggregated data for those three segments. This was more meant to be an error for frontend devs so that they have to provide only one |
Gotcha. Consider using |
Changes proposed ✍️
What
🤖 Generated by Copilot at e65d8ad
This pull request adds support for segment-based organization data in the backend. It enables the
organizationFind
endpoint to filter organizations bysegmentId
if the feature flag is on. It also modifies theOrganizationRepository
andOrganizationService
classes to use thesegmentId
parameter to calculate segment-specific metrics.
🤖 Generated by Copilot at e65d8ad
Why
How
🤖 Generated by Copilot at e65d8ad
organizationFind
endpoint (link, link)isFeatureEnabled
andFeatureFlag
from@/feature-flags
module (link)OrganizationService.findById
method (link)OrganizationRepository.findById
method (link, link)OrganizationService.findById
method (link)OrganizationRepository.findById
method (link)Checklist ✅
Feature
,Improvement
, orBug
.Add screehshots to the PR description for relevant FE changesNew backend functionality has been unit-tested.API documentation has been updated (if necessary) (see docs on API documentation).