Web developmentPublié 25 sept.
FastAPI expenses API: wrong total in paginated response
`total` returns the size of the current page instead of the number of matching records.
Description
FastAPI service with `GET /expenses?skip=&limit=&category=`.
Problem: the `total` field shows how many rows are on the current page, not how many rows match the filter. The UI paginator therefore hides pages 2+.
Expected:
- `total` = number of records matching `category` (ignoring `skip`/`limit`);
- `items` keeps working as before;
- empty result still returns `total: 0`.
Acceptance: `python -m unittest discover -s tests` passes.
Ping me here, I'll share the project and the test command. PayPal right after the fix is merged.
Compétences
- Python
- FastAPI