-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Description:
Implement server-side pagination, filtering and sorting for all list endpoints (e.g., GET /users, GET /orders) in a single combined change.
Acceptance criteria:
Query params supported: page (1-based, default 1), pageSize (default 20, max 100).
Filtering conventions supported:
field=value (exact)
field_like=value (contains)
field_from=YYYY-MM-DD & field_to=YYYY-MM-DD (range)
Sorting convention: sort=field:dir or comma-separated multi-field (example: sort=createdAt:desc,lastName:asc). Default sort applied when none provided.
Responses include metadata: { data: [...], meta: { total, page, pageSize, totalPages } }.
Invalid params yield 400 with descriptive error.
Whitelist filterable/sortable fields; everything else ignored or rejected.
API examples:
GET /users?page=2&pageSize=50&status=active&email_like=@example.com&sort=createdAt:desc
Implementation notes:
Use OFFSET/LIMIT or equivalent; validate/clamp params.
Sanitize inputs and map whitelisted fields to DB columns.