feat(saas-api): Graphql schema for FE integration for tenant management - #2176
andrii-yakovenko-flamingo wants to merge 2 commits into
Conversation
🦩 Flamingo Code Review1 finding(s) — 0 action required · 1 recommended · 0 informational Mode: advisory · 1 defect(s) outside any rule Inline comments: 1 new Need another pass? Commits pushed after this review are not reviewed automatically.
Prefer typing? Comment React 👍/👎 on inline comments to teach the reviewer. Started 2026-09-14 11:17 UTC · updated 2026-09-14 11:17 UTC · workflow run |
| Set<String> excludedOrganizationIds = filter.getExcludeOrganizationIds(); | ||
| if (excludedOrganizationIds != null && !excludedOrganizationIds.isEmpty()) { | ||
| criteriaList.add(Criteria.where(ORGANIZATION_ID_FIELD).nin(excludedOrganizationIds)); | ||
| } |
There was a problem hiding this comment.
🦩 🟠 [warn/recommended] excludeOrganizationIds filters on organizationId while other filters/sort use _id and other fields — verify field exists and is indexed
The new exclude filter is applied via Criteria.where(ORGANIZATION_ID_FIELD).nin(excludedOrganizationIds), i.e. against the document's organizationId field. Elsewhere in this same class the default/status/category/employee filters are applied directly on the Organization document fields (status, category, numberOfEmployees) and the default sort/cursor field is _id. Callers building the exclude set (e.g. from ToolConnection or existing connections) need to make sure they are populating organizationId values (the business identifier) and not Mongo _id values — passing _id strings into this set would silently produce a no-op filter since the field being compared is organizationId, not _id. There is no validation or documentation in the DTO indicating which id type is expected. Consider naming the field more explicitly (e.g. excludeByOrganizationId) or adding a comment on OrganizationFilterOptions.excludeOrganizationIds and OrganizationQueryFilter.excludeOrganizationIds clarifying it expects the business organizationId, not the Mongo document _id, and add an index recommendation since organizationId is now used in a $nin clause alongside other filters that may run frequently on the customers connection-picker path.
Evidence
Set<String> excludedOrganizationIds = filter.getExcludeOrganizationIds();
if (excludedOrganizationIds != null && !excludedOrganizationIds.isEmpty()) {
criteriaList.add(Criteria.where(ORGANIZATION_ID_FIELD).nin(excludedOrganizationIds));
}
🤖 Prompt for AI agents
In openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/organization/CustomOrganizationRepositoryImpl.java around lines 106-109, address this code-review finding: excludeOrganizationIds filters on organizationId while other filters/sort use _id and other fields — verify field exists and is indexed.
The new exclude filter is applied via Criteria.where(ORGANIZATION_ID_FIELD).nin(excludedOrganizationIds), i.e. against the document's `organizationId` field. Elsewhere in this same class the default/status/category/employee filters are applied directly on the Organization document fields (status, category, numberOfEmployees) and the default sort/cursor field is `_id`. Callers building the exclude set (e.g. from ToolConnection or existing connections) need to make sure they are populating `organizationId` values (the business identifier) and not Mongo `_id` values — passing `_id` strings into this set would silently produce a no-op filter since the field being compared is `organizationId`, not `_id`. There is no validation or documentation in the DTO indicating which id type is expected. Consider naming the field more explicitly (e.g. `excludeByOrganizationId`) or adding a comment on `OrganizationFilterOptions.excludeOrganizationIds` and `OrganizationQueryFilter.excludeOrganizationIds` clarifying it expects the business `organizationId`, not the Mongo document `_id`, and add an index recommendation since `organizationId` is now used in a $nin clause alongside other filters that may run frequently on the customers connection-picker path.
The flagged code:
```
Set<String> excludedOrganizationIds = filter.getExcludeOrganizationIds();
if (excludedOrganizationIds != null && !excludedOrganizationIds.isEmpty()) {
criteriaList.add(Criteria.where(ORGANIZATION_ID_FIELD).nin(excludedOrganizationIds));
}
```
Make the minimal change that resolves the finding; do not refactor unrelated code.
confidence: 35 — react 👍/👎 to teach the reviewer
| .status(filterOptions.getStatus()) | ||
| .lastActivityFrom(filterOptions.getLastActivityFrom()) | ||
| .lastActivityTo(filterOptions.getLastActivityTo()) | ||
| .excludeOrganizationIds(filterOptions.getExcludeOrganizationIds()) |
There was a problem hiding this comment.
What's the idea of this filter?
There was a problem hiding this comment.
We need to return a list of customers that are not assigned to a cloud provider to the FE
…ory-fe-integration
Uh oh!
There was an error while loading. Please reload this page.