DigiChanges / node-experience

Hello! NExp (Node Experience) is a boilerplate for Node, which makes use of a Hexagonal architecture, in addition to all the power of TypeScript that combined allow a perfect cohesion thus achieving a clean and at the same time very powerful implementation.
https://nexp.docs.digichanges.com
MIT License
52 stars 36 forks source link

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

Open Rutito2010 opened 7 months ago

Rutito2010 commented 7 months ago

📜 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

📋Reviewer Checklist

sonarcloud[bot] commented 7 months ago

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarCloud