TruBudget icon indicating copy to clipboard operation
TruBudget copied to clipboard

Add pagination for projects and subprojects

Open daniel-arnauer opened this issue 2 years ago • 3 comments

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

daniel-arnauer avatar May 02 '22 14:05 daniel-arnauer

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.

Stezido avatar May 04 '22 09:05 Stezido

similar to #1132 for the breaking change

daniel-arnauer avatar May 04 '22 09:05 daniel-arnauer

  • [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 and page_size/limit query params. (Or offset 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
 }
}

SamuelPull avatar Mar 20 '24 15:03 SamuelPull