mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
Add one_off filter when getting all notifications for a service
Added the option to filter by one_off messages to the DAO function `get_notifications_for_service`. Previously, one-off notifications were not returned - this has changed so that the default is for one-off notifications to be returned. Also simplified the `include_jobs` filter for this function. The DAO function gets used in 3 places - for the V1 and V2 API endpoints, which will now start to return one-off messages. It also gets used by the admin app which needs to pass in `include_one_off=False` to the `get_all_notifications_for_service` where we don't want one-off notifications to show, such as the API message log page.
This commit is contained in:
@@ -176,7 +176,8 @@ def create_notification(
|
||||
normalised_to=None,
|
||||
one_off=False,
|
||||
sms_sender_id=None,
|
||||
reply_to_text=None
|
||||
reply_to_text=None,
|
||||
created_by_id=None
|
||||
):
|
||||
if created_at is None:
|
||||
created_at = datetime.utcnow()
|
||||
@@ -221,7 +222,8 @@ def create_notification(
|
||||
'international': international,
|
||||
'phone_prefix': phone_prefix,
|
||||
'normalised_to': normalised_to,
|
||||
'reply_to_text': reply_to_text
|
||||
'reply_to_text': reply_to_text,
|
||||
'created_by_id': created_by_id
|
||||
}
|
||||
notification = Notification(**data)
|
||||
dao_create_notification(notification)
|
||||
|
||||
Reference in New Issue
Block a user