nestjs-typeorm-paginate
nestjs-typeorm-paginate copied to clipboard
feat: re-routing latest page have items
Re-routing get the latest page that has items with the option routingLatest
Description
- I found that we do not have the option to check and get the latest page has items. Let's give one scenario like this. At the front-end team, we do have
72082pages and ten items per page, a total of720821items exist on the database. Suddenly one item is deleted by someone right at the moment another clicks to the latest page it probably returns empty items and the mismatch total page was calculated.
Example UI pagination
Result without option routingLatest
After re-routing with option routingLatest
- It auto return the latest page have items
Affected areas
modified: src/tests/paginate-raw-and-entities.spec.ts modified: src/tests/paginate-raw.spec.ts modified: src/tests/paginate.query.builder.spec.ts modified: src/interfaces/index.ts modified: src/paginate.ts