remove broadcast-related code

This commit is contained in:
stvnrlly
2022-10-04 03:04:13 +00:00
parent 40dacb61c9
commit f16b5dd1c4
104 changed files with 279 additions and 38608 deletions

View File

@@ -1,59 +0,0 @@
from app.notify_client import NotifyAdminAPIClient, _attach_current_user, cache
class BroadcastMessageAPIClient(NotifyAdminAPIClient):
def create_broadcast_message(
self,
*,
service_id,
template_id,
content,
reference,
):
data = {
"service_id": service_id,
"personalisation": {},
}
if template_id:
data.update(template_id=template_id)
if content:
data.update(content=content)
if reference:
data.update(reference=reference)
data = _attach_current_user(data)
broadcast_message = self.post(
f'/service/{service_id}/broadcast-message',
data=data,
)
return broadcast_message
def get_broadcast_messages(self, service_id):
return self.get(f'/service/{service_id}/broadcast-message')['broadcast_messages']
@cache.set('service-{service_id}-broadcast-message-{broadcast_message_id}')
def get_broadcast_message(self, *, service_id, broadcast_message_id):
return self.get(f'/service/{service_id}/broadcast-message/{broadcast_message_id}')
@cache.delete('service-{service_id}-broadcast-message-{broadcast_message_id}')
def update_broadcast_message(self, *, service_id, broadcast_message_id, data):
self.post(
f'/service/{service_id}/broadcast-message/{broadcast_message_id}',
data=data,
)
@cache.delete('service-{service_id}-broadcast-message-{broadcast_message_id}')
def update_broadcast_message_status(self, status, *, service_id, broadcast_message_id):
data = _attach_current_user({
'status': status,
})
self.post(
f'/service/{service_id}/broadcast-message/{broadcast_message_id}/status',
data=data,
)
broadcast_message_api_client = BroadcastMessageAPIClient()

View File

@@ -586,26 +586,6 @@ class ServiceAPIClient(NotifyAdminAPIClient):
def get_returned_letters(self, service_id, reported_at):
return self.get("service/{}/returned-letters?reported_at={}".format(service_id, reported_at))
@cache.delete('service-{service_id}')
def set_service_broadcast_settings(
self, service_id, service_mode, broadcast_channel, provider_restriction, cached_service_user_ids
):
"""
service_mode is one of "training" or "live"
broadcast channel is one of "operator", "test", "severe", "government"
provider_restriction is one of "all", "three", "o2", "vodafone", "ee"
"""
if cached_service_user_ids:
redis_client.delete(*map('user-{}'.format, cached_service_user_ids))
data = {
"service_mode": service_mode,
"broadcast_channel": broadcast_channel,
"provider_restriction": provider_restriction
}
return self.post("/service/{}/set-as-broadcast-service".format(service_id), data)
def get_notification_count(self, service_id):
# if cache is not set, or not enabled, return 0