nestjs-typeorm-paginate icon indicating copy to clipboard operation
nestjs-typeorm-paginate copied to clipboard

feat: re-routing latest page have items

Open TonyDo99 opened this issue 10 months ago • 4 comments

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 72082 pages and ten items per page, a total of 720821 items 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

Screenshot 2025-01-11 at 18 15 57

Result without option routingLatest

Screenshot 2025-01-11 at 18 27 57

After re-routing with option routingLatest

  • It auto return the latest page have items Screenshot 2025-01-11 at 18 29 43

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

Test coverage

Screenshot 2025-01-11 at 18 30 42

TonyDo99 avatar Jan 11 '25 11:01 TonyDo99