feat: include organization info in /admin/users endpoint#153
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds functionality to optionally include organization information and spend limits when listing users via the admin API. The implementation adds a new query parameter include_organizations to the /admin/users endpoint.
- Added
UserOrganizationInfostruct to represent organization details with spend limits - Extended the admin repository and service layers with a new
list_users_with_organizationsmethod - Modified the
list_usersAPI endpoint to conditionally fetch organization data based on the query parameter
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/services/src/admin/ports.rs | Defines new UserOrganizationInfo struct and adds trait methods for fetching users with organizations |
| crates/services/src/admin/mod.rs | Implements the new service method to list users with organization data |
| crates/database/src/repositories/user.rs | Adds SQL query to fetch users with their earliest organization and spend limit |
| crates/database/src/repositories/admin_composite.rs | Implements repository layer to bridge user repository with admin service |
| crates/api/src/routes/admin.rs | Updates list_users endpoint to conditionally include organization data based on query parameter |
| crates/api/src/models.rs | Adds AdminUserOrganizationDetails struct and extends AdminUserResponse with organizations field |
| crates/api/src/conversions.rs | Updates user conversion function to include organizations field |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
crates/api/src/routes/admin.rs:783
- The
list_admin_access_tokensfunction incorrectly usesListUsersQueryParamsinstead of a dedicated query params struct. This includes theinclude_organizationsfield which is not relevant for listing access tokens. Create a separate struct or reuse an existing appropriate struct for this endpoint.
axum::extract::Query(params): axum::extract::Query<ListUsersQueryParams>,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hanakannzashi
approved these changes
Nov 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #151
Add an optional
include_organizationsparameter (falseby default) to/admin/usersendpoint.The
/admin/usersendpoint will return organization info ifinclude_organizationsis set totrue.