TruBudget
TruBudget copied to clipboard
Add pagination for projects and subprojects
Description 💡
If there are many projects or subprojects, the performance gets degredated.
All projects are fetched at once with project.list
. Add a Pagination to API and UI
TODOs:
- Change .list endpoints so only necessary data is returned. Define a schema for all resources (project, subproject, workflowitem) - e.g. remove logs for list endpoint -> Should be implemented in #1132
- pagination should be implemented on frontend side only.
similar to #1132 for the breaking change
- [x] Add a new endpoint
/v2/project.list
- [x] Increment
apiVersion
- [x] we can probably implement pagination in the service layer, i.e. fetch all projects from cache/snapshot/chain as before, and return a subset based on
page
andpage_size
/limit
query params. (Oroffset
for that matter) - [ ] make sure projects are explicitly sorted by some criterion (it seems they are sorted by creation datetime, but not sure if it's just implicit
- [ ] take into account how likely it is that other sort criteria might be requested. (alphabetical, newest first usw.) - if so, they don't have to be a breaking change if optional and don't alter request response formats
- [ ] don't forget tests. or maybe start with writing tests
- [ ] pagination also for subprojects. maybe split those into seprate issue
Example: of v2 response
{
"data":
"items": [ ... ],
"pagination": {
"total_records": 100,
"current_page": 1,
"total_pages": 10,
"next_page": 2, OR link /project.list?page=3&page_size=10
"prev_page": null,
"page_size": 10, OR limit
}
}