mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-19 05:58:53 -04:00
move BroadcastProvider from models.py to config.py
It's not something that is tied to a database table, and was causing circular import issues
This commit is contained in:
@@ -5,14 +5,14 @@ from notifications_utils.statsd_decorators import statsd
|
||||
|
||||
from app import cbc_proxy_client, notify_celery
|
||||
from app.config import QueueNames
|
||||
from app.models import BroadcastEventMessageType, BroadcastProvider
|
||||
from app.models import BroadcastEventMessageType
|
||||
from app.dao.broadcast_message_dao import dao_get_broadcast_event_by_id
|
||||
|
||||
|
||||
@notify_celery.task(name="send-broadcast-event")
|
||||
@statsd(namespace="tasks")
|
||||
def send_broadcast_event(broadcast_event_id):
|
||||
for provider in BroadcastProvider.PROVIDERS:
|
||||
for provider in current_app.config['ENABLED_CBCS']:
|
||||
# TODO: Decide whether to send to each provider based on platform admin, service level settings, broadcast
|
||||
# level settings, etc.
|
||||
send_broadcast_provider_message.apply_async(
|
||||
|
||||
@@ -2,7 +2,7 @@ import json
|
||||
|
||||
import boto3
|
||||
|
||||
from app.models import BroadcastProviders
|
||||
from app.config import BroadcastProvider
|
||||
|
||||
# The variable names in this file have specific meaning in a CAP message
|
||||
#
|
||||
@@ -70,7 +70,7 @@ class CBCProxyNoopClient:
|
||||
|
||||
class CBCProxyClient:
|
||||
provider_function_name_map = {
|
||||
BroadcastProviders.EE: 'bt-ee-1-proxy',
|
||||
BroadcastProvider.EE: 'bt-ee-1-proxy',
|
||||
}
|
||||
|
||||
def init_app(self, app):
|
||||
@@ -111,7 +111,6 @@ class CBCProxyClient:
|
||||
def send_link_test(
|
||||
self,
|
||||
identifier,
|
||||
provider,
|
||||
):
|
||||
"""
|
||||
link test - open up a connection to a specific provider, and send them an xml payload with a <msgType> of
|
||||
|
||||
@@ -56,6 +56,15 @@ class QueueNames(object):
|
||||
]
|
||||
|
||||
|
||||
class BroadcastProvider:
|
||||
EE = 'ee'
|
||||
VODAFONE = 'vodafone'
|
||||
THREE = 'three'
|
||||
O2 = 'o2'
|
||||
|
||||
PROVIDERS = [EE, VODAFONE, THREE, O2]
|
||||
|
||||
|
||||
class TaskNames(object):
|
||||
PROCESS_INCOMPLETE_JOBS = 'process-incomplete-jobs'
|
||||
ZIP_AND_SEND_LETTER_PDFS = 'zip-and-send-letter-pdfs'
|
||||
@@ -367,8 +376,7 @@ class Config(object):
|
||||
CBC_PROXY_AWS_ACCESS_KEY_ID = os.environ.get('CBC_PROXY_AWS_ACCESS_KEY_ID', '')
|
||||
CBC_PROXY_AWS_SECRET_ACCESS_KEY = os.environ.get('CBC_PROXY_AWS_SECRET_ACCESS_KEY', '')
|
||||
|
||||
# matches up with the strings in models.py::BroadcastProvider
|
||||
ENABLED_CBCS = ['ee']
|
||||
ENABLED_CBCS = {BroadcastProvider.EE}
|
||||
|
||||
|
||||
######################
|
||||
|
||||
Reference in New Issue
Block a user