-
Notifications
You must be signed in to change notification settings - Fork 35
feat: add API to search User Projects within an Org #979
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Pull Request Test Coverage Report for Build 14749767607Details
💛 - Coveralls |
There was a problem hiding this 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 a new API endpoint to search for user projects within an organization, including all necessary RPC, gateway, repository, service, and dependency wiring changes.
- Added new RPC definitions and implementations in the proto files (gRPC and gateway) for "SearchUserProjects".
- Implemented a new user projects repository with corresponding tests to generate the appropriate SQL query based on search, offset, and limit parameters.
- Updated the API handler, dependency injection, and authorization interceptor to integrate the new endpoint.
Reviewed Changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
proto/v1beta1/admin_grpc.pb.go | Added RPC constant, client and server interface for SearchUserProjects. |
proto/v1beta1/admin.pb.gw.go | Added gateway handlers and URL pattern for SearchUserProjects endpoint. |
pkg/server/interceptors/authorization.go | Added an authorization check for the SearchUserProjects endpoint. |
internal/store/postgres/user_projects_repository_test.go | Added unit tests to verify SQL query generation for user projects search. |
internal/store/postgres/user_projects_repository.go | Implemented query builder for user projects search with support for search term, offset, and limit. |
internal/api/v1beta1/v1beta1.go | Extended GRPC Handler to include userProjectsService dependency. |
internal/api/v1beta1/user_projects.go | Introduced new API endpoint implementation that transforms and returns search results. |
internal/api/api.go | Updated dependency struct to include user projects service. |
cmd/serve.go | Added userProjectsService to the dependency wiring logic. |
Files not reviewed (2)
- Makefile: Language not supported
- proto/apidocs.swagger.yaml: Language not supported
Comments suppressed due to low confidence (1)
internal/store/postgres/user_projects_repository.go:183
- The constant TABLE_BASE is used in addSearch but it is not defined, which could lead to a compile-time error. Define TABLE_BASE or update the alias to a valid constant (e.g., use an existing table alias) to ensure the query is built correctly.
baseSubquery := query.As(TABLE_BASE)
Add Search User Projects inside an Org API
Description
Added a new API endpoint to search projects for a specific user within an organization. This endpoint allows administrators to list and search projects that a user has access to within a given organization.
Implementation Details
/v1beta1/admin/users/{user_id}/organizations/{org_id}/projects
Database Query
The implementation uses an optimized SQL query that:
Testing
Example Usage
Response includes:
Related Issues
raystack/proton#407