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

[www] Add support for pagination to the proposal list routes #43

Closed
sndurkin opened this issue Sep 29, 2017 · 1 comment
Closed

[www] Add support for pagination to the proposal list routes #43

sndurkin opened this issue Sep 29, 2017 · 1 comment

Comments

@sndurkin
Copy link
Contributor

sndurkin commented Sep 29, 2017

Pagination should be done like reddit's API, with support for the following:

  • after: the id of the last proposal on the previous page
  • before: used for navigating backwards through the list in the UI, it's the id of the first proposal on the previous page
  • limit: (optional) the number of proposals to fetch in the page
@sndurkin sndurkin changed the title [www] Add support for pagination to the proposal list routes [www/ui] Add support for pagination to the proposal list routes Sep 29, 2017
@sndurkin sndurkin changed the title [www/ui] Add support for pagination to the proposal list routes [www] Add support for pagination to the proposal list routes Sep 29, 2017
@go1dfish
Copy link

go1dfish commented Oct 4, 2017

We need to be able to paginate api endpoints for proposal lists.

I recommend the approach reddit uses.

A list is sorted in some way (let's assume new)

To get a page, I specify the limit (max number of items returned) and an optional start/end point.

You could have a default limit of 20.

For these examples, assume the list is sorted by newest first.

To get a page of i items I fetch

/vetted?limit=20

To get the next oldest page, I would fetch:

/vetted?limit=20&before=<idofthelastiteminpreviouspage>

A meta key can be added to the response as a sibling to proposals

{
  proposals: [...]
  meta: { total: 9123 }
}

vibros68 pushed a commit to vibros68/politeia that referenced this issue Aug 17, 2021
vibros68 pushed a commit to vibros68/politeia that referenced this issue Aug 17, 2021
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

No branches or pull requests

2 participants