mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-29 04:09:07 -04:00
Refactor to add separate letter branding client
We were getting all letter logos from a method in the email branding client. Since we will be adding more client methods to deal with letters, it makes things clearer to separate the email and letter branding clients.
This commit is contained in:
@@ -61,6 +61,7 @@ from app.notify_client.user_api_client import user_api_client
|
||||
from app.notify_client.events_api_client import events_api_client
|
||||
from app.notify_client.provider_client import provider_client
|
||||
from app.notify_client.email_branding_client import email_branding_client
|
||||
from app.notify_client.letter_branding_client import letter_branding_client
|
||||
from app.notify_client.organisations_api_client import organisations_client
|
||||
from app.notify_client.org_invite_api_client import org_invite_api_client
|
||||
from app.notify_client.letter_jobs_client import letter_jobs_client
|
||||
@@ -125,6 +126,7 @@ def create_app(application):
|
||||
events_api_client.init_app(application)
|
||||
provider_client.init_app(application)
|
||||
email_branding_client.init_app(application)
|
||||
letter_branding_client.init_app(application)
|
||||
organisations_client.init_app(application)
|
||||
letter_jobs_client.init_app(application)
|
||||
inbound_number_client.init_app(application)
|
||||
|
||||
@@ -19,6 +19,7 @@ from app import (
|
||||
current_service,
|
||||
email_branding_client,
|
||||
inbound_number_client,
|
||||
letter_branding_client,
|
||||
organisations_client,
|
||||
service_api_client,
|
||||
user_api_client,
|
||||
@@ -854,7 +855,7 @@ def service_preview_email_branding(service_id):
|
||||
def set_letter_branding(service_id):
|
||||
|
||||
form = LetterBranding(
|
||||
choices=email_branding_client.get_letter_email_branding().items(),
|
||||
choices=letter_branding_client.get_letter_branding().items(),
|
||||
dvla_org_id=current_service.dvla_organisation,
|
||||
)
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ from app.notify_client.email_branding_client import email_branding_client
|
||||
from app.notify_client.inbound_number_client import inbound_number_client
|
||||
from app.notify_client.invite_api_client import invite_api_client
|
||||
from app.notify_client.job_api_client import job_api_client
|
||||
from app.notify_client.letter_branding_client import letter_branding_client
|
||||
from app.notify_client.organisations_api_client import organisations_client
|
||||
from app.notify_client.service_api_client import service_api_client
|
||||
from app.notify_client.template_folder_api_client import (
|
||||
@@ -304,7 +305,7 @@ class Service():
|
||||
|
||||
@cached_property
|
||||
def letter_branding(self):
|
||||
return email_branding_client.get_letter_email_branding().get(
|
||||
return letter_branding_client.get_letter_branding().get(
|
||||
self.dvla_organisation, '001'
|
||||
)
|
||||
|
||||
|
||||
@@ -23,9 +23,6 @@ class EmailBrandingClient(NotifyAdminAPIClient):
|
||||
return branding['id']
|
||||
return None
|
||||
|
||||
def get_letter_email_branding(self):
|
||||
return self.get(url='/dvla_organisations')
|
||||
|
||||
@cache.delete('email_branding')
|
||||
def create_email_branding(self, logo, name, text, colour, domain, brand_type):
|
||||
data = {
|
||||
|
||||
13
app/notify_client/letter_branding_client.py
Normal file
13
app/notify_client/letter_branding_client.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from app.notify_client import NotifyAdminAPIClient
|
||||
|
||||
|
||||
class LetterBrandingClient(NotifyAdminAPIClient):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("a" * 73, "b")
|
||||
|
||||
def get_letter_branding(self):
|
||||
return self.get(url='/dvla_organisations')
|
||||
|
||||
|
||||
letter_branding_client = LetterBrandingClient()
|
||||
Reference in New Issue
Block a user