8000 feat: add api to search user organizations by whoAbhishekSah · Pull Request #947 · raystack/frontier · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: add api to search user organizations #947

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

Merged
merged 6 commits into from
Apr 21, 2025

Conversation

whoAbhishekSah
Copy link
Member
@whoAbhishekSah whoAbhishekSah commented Apr 14, 2025

Add Search organizations by user ID endpoint

This PR adds a new endpoint for searching organizations associated with a user. The endpoint returns organization details, along with role information and project counts for each organization.

API

GET /v1beta1/admin/users/{user_id}/organizations/search

Example:

curl --location 'localhost:8000/v1beta1/admin/users/0bc16086-99a6-4f19-9689-1ad4e819ff63/organizations/search' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Basic {token}' \
--data '{}'

Changes

  • Added new UserOrgsRepository to handle organization queries for a user
  • Added query builder to fetch organizations with:
    • Basic organization details (name, title, avatar)
    • Aggregated role information (names, titles, IDs)
    • Project count per organization
    • Organization join date
  • Added unit tests for query builder
  • RQL interface is kept for future extensibility but currently returns error if filters/sort/search are provided

Notes

  • Uses LEFT JOIN with projects to include organizations with zero projects
  • Groups roles to avoid duplicate organizations in results
  • Orders results by organization name
  • Project count only includes non-deleted and enabled projects

Testing

  • Added unit tests for query builder
  • Manually tested with various user IDs
  • Verified project count accuracy
  • Verified role aggregation

Copy link
vercel bot commented Apr 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
frontier ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 14, 2025 9:34am

@whoAbhishekSah whoAbhishekSah force-pushed the user_org_membership_search branch from e3ec676 to de21c8e Compare April 14, 2025 09:30
@whoAbhishekSah
Copy link
Member Author

Proton PR: raystack/proton#403

@whoAbhishekSah whoAbhishekSah merged commit 79ce962 into main Apr 21, 2025
7 checks passed
@whoAbhishekSah whoAbhishekSah deleted the user_org_membership_search branch April 21, 2025 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0