Add backend pagination and filtering for all hosted and remote instance list endpoints
- Dominant language
- JavaScript
- Stars
- 400
- Forks
- 89
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 149
Description
Some of our instance listing endpoints load everything in one go and leave pagination/filtering to the frontend. This doesn't scale and we should move to proper backend pagination and filtering across the board.
## Current state
* `GET /api/v1/teams/:teamId/projects` already supports `page`, `limit`, `query`, `sort`, `dir`, and `state` filtering. The team hosted instances page (`pages/team/Instances.vue`) uses these.
* `GET /api/v1/applications/:applicationId/instances` has **no pagination support at all**. It loads every instance via `Project.byApplication()` and returns a flat `{ count, instances }` response with no pagination metadata.
* `GET /api/v1/teams/:teamId/devices` and `GET /api/v1/projects/:instanceId/devices` already support full pagination, search, sort, and filter parameters. These are in good shape.
* Application-level device listing goes through the team endpoint with context filtering, which also works.
## What needs to happen
* Add pagination, search, sorting, and status filtering to `GET /api/v1/applications/:applicationId/instances` to match what the team-level endpoint already supports
* Audit the team-level instances endpoint to make sure its filtering capabilities are complete (it supports `state` filtering but might be missing other useful filters)
* Update the frontend pages to use server-side pagination instead of loading all instances
* Make sure both hosted and remote instance lists across all contexts (team level, application level) consistently use backend pagination
**Note:** Application-level pagination is out of scope for now. This is focused on the instance/device list endpoints within those contexts.
This is a prerequisite for the other hosted/remote instance unification efforts since proper filtering and pagination on the backend is needed before the UI work can land cleanly.
Contributor guide
Assessment
This issue has not been assessed yet.