Skip to content
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

Add basic support for seek-based pagination to versions endpoint #8037

Merged
merged 2 commits into from
Mar 1, 2024

Conversation

eth3lbert
Copy link
Contributor

@eth3lbert eth3lbert commented Jan 31, 2024

This PR is an improved implementation of #5302.
Add seek-based pagination support to versions endpoint with following:

  • move versions to its own file
  • To keep backward compatibility, paginate versions only if per_page is provided.
  • Support sort query parameter to choose either sorting by date or semver .

For date sorting, we can perform sorting and pagination directly in the database. However, Heroku Postgres doesn't support the semver PG extension, so sorting and pagination for semver needs to be done on the app server.

Resolves #5292

Copy link

codecov bot commented Jan 31, 2024

Codecov Report

Attention: Patch coverage is 98.89807% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 87.86%. Comparing base (5a5b2ab) to head (93e7362).
Report is 4 commits behind head on main.

Files Patch % Lines
src/controllers/krate/versions.rs 98.37% 3 Missing ⚠️
src/tests/routes/crates/versions/list.rs 99.43% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8037      +/-   ##
==========================================
+ Coverage   87.73%   87.86%   +0.12%     
==========================================
  Files         271      272       +1     
  Lines       27145    27477     +332     
==========================================
+ Hits        23817    24143     +326     
- Misses       3328     3334       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Turbo87 Turbo87 added C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works A-backend ⚙️ labels Feb 1, 2024
Prepare for implementing pagination support for the versions endpoint.
@Turbo87 Turbo87 force-pushed the versions-pagination branch from 55e555f to 3f1a04e Compare February 22, 2024 09:36
Copy link
Member

@Turbo87 Turbo87 left a comment

Choose a reason for hiding this comment

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

one small bug, and a couple of comments, but overall this looks good to me. nice work! 👍

@Turbo87
Copy link
Member

Turbo87 commented Feb 22, 2024

and in case you're wondering, I've rebased the branch on the current main :)

@eth3lbert
Copy link
Contributor Author

feedback addressed. thanks for the review :)

diff 3f1a04e90057ae7f3714bcf3e6bd165223f00710..93e73621ccaac6b05afecc8d7488858aa84ae0b9

@eth3lbert eth3lbert requested a review from Turbo87 February 29, 2024 19:50
Copy link
Member

@Turbo87 Turbo87 left a comment

Choose a reason for hiding this comment

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

alright, let's give this a try! the test changes are all additive so I'm assuming the existing functionality won't break :)

@Turbo87 Turbo87 merged commit a75d8ce into rust-lang:main Mar 1, 2024
9 checks passed
@eth3lbert eth3lbert deleted the versions-pagination branch March 2, 2024 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add paginated versions API
2 participants