mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 15:15:38 -05:00
Add brand_type to EmailBranding.
It makes more sense to put the brand_type with EmailBranding rather than in Service. Next step is to add the new type to the form in admin app.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from app.models import BRANDING_TYPES
|
||||
|
||||
post_create_email_branding_schema = {
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"description": "POST schema for getting email_branding",
|
||||
@@ -10,6 +12,7 @@ post_create_email_branding_schema = {
|
||||
"text": {"type": ["string", "null"]},
|
||||
"logo": {"type": ["string", "null"]},
|
||||
"domain": {"type": ["string", "null"]},
|
||||
"brand_type": {"enum": BRANDING_TYPES},
|
||||
},
|
||||
"required": []
|
||||
}
|
||||
@@ -26,6 +29,7 @@ post_update_email_branding_schema = {
|
||||
"text": {"type": ["string", "null"]},
|
||||
"logo": {"type": ["string", "null"]},
|
||||
"domain": {"type": ["string", "null"]},
|
||||
"brand_type": {"enum": BRANDING_TYPES},
|
||||
},
|
||||
"required": []
|
||||
}
|
||||
|
||||
@@ -192,6 +192,7 @@ BRANDING_GOVUK = 'govuk'
|
||||
BRANDING_ORG = 'org'
|
||||
BRANDING_BOTH = 'both'
|
||||
BRANDING_ORG_BANNER = 'org_banner'
|
||||
BRANDING_TYPES = [BRANDING_GOVUK, BRANDING_ORG, BRANDING_BOTH, BRANDING_ORG_BANNER]
|
||||
|
||||
|
||||
class BrandingTypes(db.Model):
|
||||
@@ -209,6 +210,13 @@ class EmailBranding(db.Model):
|
||||
name = db.Column(db.String(255), nullable=True)
|
||||
text = db.Column(db.String(255), nullable=True)
|
||||
domain = db.Column(db.Text, nullable=True)
|
||||
brand_type = db.Column(
|
||||
db.String(255),
|
||||
db.ForeignKey('branding_type.name'),
|
||||
index=True,
|
||||
nullable=True,
|
||||
default=BRANDING_GOVUK
|
||||
)
|
||||
|
||||
def serialize(self):
|
||||
serialized = {
|
||||
@@ -219,7 +227,8 @@ class EmailBranding(db.Model):
|
||||
"text": self.text,
|
||||
"banner_colour": self.banner_colour,
|
||||
"single_id_colour": self.single_id_colour,
|
||||
"domain": self.domain
|
||||
"domain": self.domain,
|
||||
"brand_type": self.brand_type
|
||||
}
|
||||
|
||||
return serialized
|
||||
|
||||
Reference in New Issue
Block a user