add pagination to GET /service/{}/job

accepts a page parameter to control what page of data

returns additional pagination fields in the response dict
* page_size: will always be 50. defined by Config.PAGE_SIZE
* total: the total amount of unpaginated records
* links: dict containing optionally prev, next, and last, links to
  other relevant pagination pages

also cleaned up some test imports
This commit is contained in:
Leo Hemsted
2016-09-21 16:54:02 +01:00
parent 4bfcfcd2fb
commit 24903a19ef
3 changed files with 169 additions and 92 deletions

View File

@@ -4,7 +4,7 @@ from flask import url_for
def pagination_links(pagination, endpoint, **kwargs):
if 'page' in kwargs:
kwargs.pop('page', None)
links = dict()
links = {}
if pagination.has_prev:
links['prev'] = url_for(endpoint, page=pagination.prev_num, **kwargs)
if pagination.has_next: