Review
Add pagination to users endpoint
List endpoint was returning the full table. Adds page/size query params so the mobile client can page through users.
FastAPITier 1apibugs
Click a line to flag it, pick one or more labels, then submit. If the change looks correct, approve it.
app/routes/users.py+4-2
| 24 | 24 | @app.get("/users") | |
| 25 | - | def list_users(): | |
| 26 | - | return db.query(User).all() | |
| 25 | + | def list_users(page: int = 1, size: int = 20): | |
| 26 | + | offset = (page - 1) * size | |
| 27 | + | users = db.query(User).all() | |
| 28 | + | return users[offset : offset + size + 1] |