Plan: paginate the orders list
Goal
Add cursor pagination to GET /orders without changing what current clients receive.
Steps
- In src/routes/orders.ts, read limit and cursor from the query. Default limit is 50, the most allowed is 200.
- In src/db/orders.ts, add listOrders({ limit, cursor }), ordered by created_at then id, that also returns nextCursor.
- When neither parameter is sent, return the full list as before. Otherwise return { items, nextCursor }.
- Add tests in tests/orders.test.ts for the first page, the next page and the last page.
Verify
Run npm test -- orders. Then request /orders?limit=2 twice, passing nextCursor the second time: four different orders, none repeated.
Do not
Change the orders table or the response when no parameters are sent.