Paginate search results for notifications

The standard way that we indicate that there are more results than can
be returned is by paginating. So even though we don’t intend to paginate
the search results in the admin app, it can still use the presence or
absence of a ‘next’ link to determine whether or not to show a message
about only showing the first 50 results.
This commit is contained in:
Chris Hill-Scott
2020-05-01 11:18:33 +01:00
parent 625aad97c9
commit 80fc5e6600
4 changed files with 98 additions and 63 deletions

View File

@@ -475,10 +475,19 @@ def search_for_notification_by_to_field(service_id, search_term, statuses, notif
service_id=service_id,
search_term=search_term,
statuses=statuses,
notification_type=notification_type
notification_type=notification_type,
page=1,
page_size=current_app.config['PAGE_SIZE'],
)
return jsonify(
notifications=notification_with_template_schema.dump(results, many=True).data
notifications=notification_with_template_schema.dump(results.items, many=True).data,
links=pagination_links(
results,
'.get_all_notifications_for_service',
statuses=statuses,
notification_type=notification_type,
service_id=service_id,
),
), 200