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 pagination details in the query endpoint responses #113

Closed
aurelticot opened this issue Sep 12, 2024 · 2 comments · Fixed by #114
Closed

Add pagination details in the query endpoint responses #113

aurelticot opened this issue Sep 12, 2024 · 2 comments · Fixed by #114

Comments

@aurelticot
Copy link
Member

aurelticot commented Sep 12, 2024

For /db/query and /ds/query, the response is simply composed of an items array.

It would be helpful to also return details of the pagination:

{
  "items": [],
  "limit": 10, // not particulary necessary as it comes from the request originally but could be useful in some cases
  "skipped": 30, // not particulary necessary as it comes from the request originally but could be useful in some cases
  "totalCount": 1234, // This is the useful information, so we can define the pagination
}

The totalCount should take into accout the filter of the query.

For limit and skipped, may there are other best practices for the terminology.

@tahpot
Copy link
Member

tahpot commented Sep 13, 2024

The totalCount should take into accout the filter of the query.

PouchDb doesn't support a total count with a filter applied. I can return a count of all records, without the filter. I could code something manually to iterate through all the pages to calculate a total, but that seems like a waste of resources.

The rest is fine.

@aurelticot
Copy link
Member Author

I can return a count of all records, without the filter

Ok, but if you can name the variable unfilteredTotalCount that would avoid ambiguity.

I'll try to figure out a thing in the UI about the pagination.

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 a pull request may close this issue.

2 participants