-
Notifications
You must be signed in to change notification settings - Fork 31
Feature: Add option to search by username or paginate the /users endpoint #13
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
Feature: Add option to search by username or paginate the /users endpoint #13
Conversation
|
Very good. |
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 search and pagination functionality to the /users endpoint. The changes allow the UI to filter users by a substring of the username and paginate the results, and new unit tests have been added to verify these enhancements.
- Extended /users endpoint to support filtering by a search parameter.
- Introduced pagination using page and pagesize parameters.
- Updated unit tests and helper methods to support these features.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/controllers/test_users_controller.rb | Added tests for searching users by username and pagination behavior. |
| helpers/users_helper.rb | Introduced a helper (get_users) to handle search filtering and pagination. |
| controllers/users_controller.rb | Updated endpoint to use get_users and modified create_user signature. |
| Gemfile | Removed an unused dependency (net-ftp). |
|
Just for my own knowledge: is the Copilot automatic description comment a good one? (on a scale from 1 to 5) ? |
3.75 |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
At first i didn't follow this structure of pagination, but as we discussed last time, we will follow the same structure like here to make our endpoints has optional pagination (the endpoints that need this) |
|
@syphax-bouazzouni This works very well! While the minimum number of characters to trigger a search can be enforced on the UI side, it might still be worth considering paginating results by default. Currently, performance slows down when searching with one- or two-character queries. |
Context
will help fix ncbo/bioportal_web_ui#411, ncbo/bioportal_web_ui#372
See details of the issue here ncbo/bioportal_web_ui#409 (comment)
With this PR, we will have the option in the UI to use either
/users?search=syphax, it will return only the users with a username containingsyphaxIn addition it give the option to paginate the page if needed, by adding
page=<number>, e.g/users?page=1Changes
/usersissue (453fa55)/usersendpoint (153eb82)