GEWIS / sudosos-backend

SudoSOS is a Node.js-based Bar and POS system made for study association GEWIS.
https://sudosos.gewis.nl
GNU Affero General Public License v3.0
4 stars 3 forks source link

[BUG] Pagination returns 200 OK when not everything is OK #267

Closed CodeNamedRobin closed 1 week ago

CodeNamedRobin commented 3 weeks ago

Current behavior

Whenever the backend returns a paginated response, the status will be 200, even though not all parameters are succesfully handled. For example, try to get more than 500 users, and only silently there will be only 500 results returned.

Desired behavior

In this situation, I expected a different response code. This could be a 400 Bad Request, but that is kind of harsh. Maybe 206 partial content, but that is not exactly within normally used standards.

API Route

No response

Steps to reproduce

Do a request on the Swagger with take parameter more than 500, observe the 200 OK.

Logs and Error Messages

No response

Other Information

No response

Yoronex commented 3 weeks ago

By design, there is a maximum limit on the amount of entries one can request using pagination. Indeed, when you request 1000 records, you will ever only get at most 500. The actual amount of records used by the backend is also correctly reflected in the _pagination object, namely the used skip and take.

Therefore, I am not really convinced whether we should change the current pagination behaviour, as the backend is not doing anything it is not telling you.

JustSamuel commented 1 week ago

Closed since I agree with @Yoronex and no response was given.