mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
Shorten name of broadcast utility function
This is doing more than just validating and updating an is about to do even more. Saying "update" is broad enough to cover the others.
This commit is contained in:
@@ -2,14 +2,12 @@ import iso8601
|
||||
from flask import Blueprint, jsonify, request
|
||||
from notifications_utils.template import BroadcastMessageTemplate
|
||||
|
||||
from app.broadcast_message import utils as broadcast_utils
|
||||
from app.broadcast_message.broadcast_message_schema import (
|
||||
create_broadcast_message_schema,
|
||||
update_broadcast_message_schema,
|
||||
update_broadcast_message_status_schema,
|
||||
)
|
||||
from app.broadcast_message.utils import (
|
||||
validate_and_update_broadcast_message_status,
|
||||
)
|
||||
from app.dao.broadcast_message_dao import (
|
||||
dao_get_broadcast_message_by_id_and_service_id,
|
||||
dao_get_broadcast_messages_for_service,
|
||||
@@ -162,6 +160,6 @@ def update_broadcast_message_status(service_id, broadcast_message_id):
|
||||
status_code=400
|
||||
)
|
||||
|
||||
validate_and_update_broadcast_message_status(broadcast_message, new_status, updating_user)
|
||||
broadcast_utils.update_broadcast_message_status(broadcast_message, new_status, updating_user)
|
||||
|
||||
return jsonify(broadcast_message.serialize()), 200
|
||||
|
||||
@@ -13,7 +13,7 @@ from app.models import (
|
||||
)
|
||||
|
||||
|
||||
def validate_and_update_broadcast_message_status(broadcast_message, new_status, updating_user=None, api_key_id=None):
|
||||
def update_broadcast_message_status(broadcast_message, new_status, updating_user=None, api_key_id=None):
|
||||
_validate_broadcast_update(broadcast_message, new_status, updating_user)
|
||||
|
||||
if new_status == BroadcastStatusType.BROADCASTING:
|
||||
|
||||
@@ -6,10 +6,8 @@ from notifications_utils.template import BroadcastMessageTemplate
|
||||
from sqlalchemy.orm.exc import MultipleResultsFound
|
||||
|
||||
from app import api_user, authenticated_service, redis_store
|
||||
from app.broadcast_message import utils as broadcast_utils
|
||||
from app.broadcast_message.translators import cap_xml_to_dict
|
||||
from app.broadcast_message.utils import (
|
||||
validate_and_update_broadcast_message_status,
|
||||
)
|
||||
from app.dao.broadcast_message_dao import (
|
||||
dao_get_broadcast_message_by_references_and_service_id,
|
||||
)
|
||||
@@ -121,7 +119,7 @@ def _cancel_or_reject_broadcast(references_to_original_broadcast, service_id):
|
||||
new_status = BroadcastStatusType.REJECTED
|
||||
else:
|
||||
new_status = BroadcastStatusType.CANCELLED
|
||||
validate_and_update_broadcast_message_status(
|
||||
broadcast_utils.update_broadcast_message_status(
|
||||
broadcast_message,
|
||||
new_status,
|
||||
api_key_id=api_user.id
|
||||
|
||||
Reference in New Issue
Block a user