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
fix: document service find many pagination #20178
Conversation
I am creating tests in the meantime |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
I'm not sure I like the way you had to change the db layer to support this.
IMHO we should remove all notion of page & pageSize on the db layer.
For those page to limit/offset transforms I'm not sure we should do it here, the convertQueryParams is supposed to pass the same params it receives but formatted, this can have a huge impact on people using it and I'm not sure I see a good enough reason to do that here 🤔
agree on this, this would mean removing the "findPage" method from the db layer, which atm I do not see it as a good idea
Alright :) , two solutions then:
I would go for the first option, wdyt? |
How did we support it in the findMany of the entityService ? I think we can go with this, even if long term I'm not sure I would |
We did not support it on the findMany, we had a findPage method |
I don't think we have enough bandwidth to just complete drop that and refactor everywhere else, let's support it in the findMany for convenience |
|
🤝 will start working on that |
I don't think we have enough bandwidth to just complete drop that and refactor everywhere else, let's support it in the findMany for convenience. side note if we do support it I feel like there was no real point of dropping findPage 🤔 |
No strong opinion, findPage did support both page&pageSize and start&limit, just that the response included the page count. Keeping it would make the life a bit easier for users (specially migrating from v4), also would introduce a 4th "findX" method to document. If findPage supported both start&limit I think it would make sense for the findmany to support those too. |
I don't think findMany should know what's a page at all that's my concern, if we added cursor based pagination we would not support it in findMany butexpect it to be converted to a limit & a filter on a column, |
alright ! do you think we should reintroduce the findPage method in the doc service then? |
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.
The code looks good :+1
If you can add tests for both the CM & the content API that would be 🔥
@alexandrebodin created tests for the CM, and content api tests where skipped :hehe: everything should be covered. Not checked, but do you think we need to work on the graphql part too? |
Niceee all good then, For graphql we use the utils but that one you didn't change so we should be good. orther checking if we have some tests that exist or not though |
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.
Did QA locally and works great 🥳
What does it do?
We allowed page & pageSize parameters on find Many, but those params were not properly converted to the offset & limit database params.
This PR proposes a fix, which always converts pagination params to offset and limit, so both page & pagesize, and start & limit works on the
findMany
method, or any other that accepts pagination.How to test
Go to the List View of the CMS, and the pages should load correctlly, 10 entities at a time
Fixes #20005