Skip to content

feat: include organization info in /admin/users endpoint#153

Merged
think-in-universe merged 8 commits into
mainfrom
feat/admin-user-include-org
Nov 6, 2025
Merged

feat: include organization info in /admin/users endpoint#153
think-in-universe merged 8 commits into
mainfrom
feat/admin-user-include-org

Conversation

@think-in-universe
Copy link
Copy Markdown
Contributor

@think-in-universe think-in-universe commented Nov 6, 2025

Fixes #151

Add an optional include_organizations parameter (false by default) to /admin/users endpoint.

The /admin/users endpoint will return organization info if include_organizations is set to true.

Copilot AI review requested due to automatic review settings November 6, 2025 08:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 UserOrganizationInfo struct to represent organization details with spend limits
  • Extended the admin repository and service layers with a new list_users_with_organizations method
  • Modified the list_users API 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.

Comment thread crates/api/src/routes/admin.rs Outdated
Comment thread crates/services/src/admin/mod.rs Outdated
Comment thread crates/database/src/repositories/user.rs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_tokens function incorrectly uses ListUsersQueryParams instead of a dedicated query params struct. This includes the include_organizations field 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.

Comment thread crates/database/src/repositories/user.rs Outdated
@think-in-universe think-in-universe merged commit 3f8b738 into main Nov 6, 2025
1 check failed
@think-in-universe think-in-universe deleted the feat/admin-user-include-org branch November 6, 2025 13:17
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.

Enhancement: return default organization ID in /admin/users endpoint

3 participants