mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-18 21:48:49 -04:00
Remove support for "areas_2" field
The Admin app was only using this temporarily and is now using the "areas" field instead [1], so we can delete this one. [1]: https://github.com/alphagov/notifications-admin/pull/4006
This commit is contained in:
@@ -14,7 +14,6 @@ create_broadcast_message_schema = {
|
||||
'starts_at': {'type': 'string', 'format': 'datetime'},
|
||||
'finishes_at': {'type': 'string', 'format': 'datetime'},
|
||||
'areas': {'type': 'object'},
|
||||
'areas_2': {'type': 'object'},
|
||||
'content': {'type': 'string', 'minLength': 1},
|
||||
'reference': {'type': 'string', 'minLength': 1, 'maxLength': 255},
|
||||
},
|
||||
@@ -42,7 +41,6 @@ update_broadcast_message_schema = {
|
||||
'starts_at': {'type': 'string', 'format': 'datetime'},
|
||||
'finishes_at': {'type': 'string', 'format': 'datetime'},
|
||||
'areas': {'type': 'object'},
|
||||
'areas_2': {'type': 'object'},
|
||||
},
|
||||
'required': [],
|
||||
'additionalProperties': False
|
||||
|
||||
@@ -138,7 +138,7 @@ def create_broadcast_message(service_id):
|
||||
template_id=template_id,
|
||||
template_version=template.version if template else None,
|
||||
personalisation=personalisation,
|
||||
areas=data.get("areas", data.get("areas_2", {})), # TEMPORARY: while we repurpose "areas"
|
||||
areas=data.get("areas", {}),
|
||||
status=BroadcastStatusType.DRAFT,
|
||||
starts_at=_parse_nullable_datetime(data.get('starts_at')),
|
||||
finishes_at=_parse_nullable_datetime(data.get('finishes_at')),
|
||||
@@ -170,8 +170,7 @@ def update_broadcast_message(service_id, broadcast_message_id):
|
||||
status_code=400
|
||||
)
|
||||
|
||||
# TEMPORARY: while we repurpose "areas"
|
||||
areas = data.get("areas", data.get("areas_2", {}))
|
||||
areas = data.get("areas", {})
|
||||
|
||||
if ('ids' in areas and 'simple_polygons' not in areas) or ('ids' not in areas and 'simple_polygons' in areas):
|
||||
raise InvalidRequest(
|
||||
|
||||
@@ -2353,10 +2353,7 @@ class BroadcastMessage(db.Model):
|
||||
'personalisation': self.personalisation if self.template else None,
|
||||
'content': self.content,
|
||||
|
||||
# TEMPORARY: switch to this so we can repurpose "areas"
|
||||
'areas_2': areas,
|
||||
'areas': areas,
|
||||
|
||||
'status': self.status,
|
||||
|
||||
'starts_at': get_dt_string_or_none(self.starts_at),
|
||||
|
||||
Reference in New Issue
Block a user