mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 00:41:35 -05:00
Validate that both polygons and areas have to be updated
Because areas and polygons for broadcast messages should be in sync.
This commit is contained in:
@@ -132,6 +132,12 @@ def update_broadcast_message(service_id, broadcast_message_id):
|
||||
status_code=400
|
||||
)
|
||||
|
||||
if ('areas' in data and 'simple_polygons' not in data) or ('areas' not in data and 'simple_polygons' in data):
|
||||
raise InvalidRequest(
|
||||
f'Cannot update broadcast_message {broadcast_message.id}, areas or polygons are missing.',
|
||||
status_code=400
|
||||
)
|
||||
|
||||
if 'personalisation' in data:
|
||||
broadcast_message.personalisation = data['personalisation']
|
||||
if 'starts_at' in data:
|
||||
|
||||
Reference in New Issue
Block a user