Sales · orders
The orders live in a Node service.
Every one must be read, with its lines.
Express, Sequelize 6.37, 130 orders
The problem
The API returns the list in pages.
- offset and limit, 50 per page.
- Every page gives a count.
What is not changed
The service stays as it is.
- Its API, read only.
- No module, no setting.
The trap
The count counts the joined lines.
- include without distinct: true.
- 260 announced for 130 orders.
What had to be written
pagination: { kind: sequelize }One line.
- Each page's count is checked.
- A 21-line connector.
When the total is wrong
The run fails, it does not lie.
- 260 announced, 130 read.
- The message gives both numbers.
The fix
It lives in the service.
- distinct: true in findAndCountAll.
- 130 of 130, read again if the list moves.
Try it
The scenario replays locally.
Every step is published with its output.