node-experience icon indicating copy to clipboard operation
node-experience copied to clipboard

feat (NEXP): add page instead of offset as pagination request option

Open Rutito2010 opened this issue 1 year ago • 1 comments

📜 Description

To avoid force the frontend to calculate and offset to select a page of a pagination we move that logic to the backend

option [page] as added to Pagination object

in case that page param come we use it to calculate the correct offset and return a response to the frontend

this param has priority over "offset" param

its still an optional param so paginate its still able to work with limit and offset

if it come we take the page parameter and multiply by limit to know how much offset we need on the db query

**Notes: Only works on Mongo queries

🧪 Accept Criteria Tests

adding a page param on should return the correct offset number

if a no existent page is passed return an empty array

🔮 Last Notes

📋 Author Checklist

  • [ ] Review my on PR.

📋Reviewer Checklist

  • [ ] There is no hardcoding in the code.
  • [ ] The tests cover various aspects of functionality.
  • [ ] There is no any type in the code.
  • [ ] The target branch is main.

Rutito2010 avatar Mar 25 '24 21:03 Rutito2010

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
33.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Apr 05 '24 13:04 sonarqubecloud[bot]