mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 23:41:17 -05:00
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:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user