This adds pagination support to the API schema and DB queries
Added a new POST /users/search endpoint to have an example of a paginated endpoint.
Context for reviewers
There are likely more features that could be built ontop of this (multi-field sorting, Paginator class as an iterator, and a few other utilities), but was focused on getting the core functionality of pagination working in a fairly general manner.
This approach for pagination is based on a mix of past projects and partially based on the Flask-SQLAlchemy libraries approach.
Testing
Added a bunch of users locally by calling the POST /users endpoint, but only one which would be found by the following query:
Ticket
Resolves https://github.com/navapbc/template-application-flask/issues/210
Changes
This adds pagination support to the API schema and DB queries
Added a new
POST /users/search
endpoint to have an example of a paginated endpoint.Context for reviewers
There are likely more features that could be built ontop of this (multi-field sorting, Paginator class as an iterator, and a few other utilities), but was focused on getting the core functionality of pagination working in a fairly general manner.
This approach for pagination is based on a mix of past projects and partially based on the Flask-SQLAlchemy libraries approach.
Testing
Added a bunch of users locally by calling the POST /users endpoint, but only one which would be found by the following query:
And got the following response (with the data removed as it's a lot):
Further testing was done, and can be seen in the unit tests to verify the paging/sorting behavior.