mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 06:21:50 -05:00
add organisation and branding models
a service now has branding and organisation_id columns, and two new
tables have been aded to reflect these:
* branding is a static types table referring to how a service wants
their emails to be branded:
* 'govuk' for GOV UK branding (default)
* 'org' for organisational branding only
* 'both' for co-branded output with both
* organisation is a table defining an organisation's branding. this
contains three entries, all of which are nullable
* colour - a hex code for a coloured bar on the logo's left
* logo - relative path for that org's logo image
* name - the name to display on the right of the logo
This commit is contained in:
@@ -5,7 +5,7 @@ from sqlalchemy.dialects.postgresql import (
|
||||
UUID,
|
||||
JSON
|
||||
)
|
||||
from sqlalchemy import UniqueConstraint
|
||||
from sqlalchemy import UniqueConstraint, text
|
||||
|
||||
from app.encryption import (
|
||||
hashpw,
|
||||
@@ -74,6 +74,24 @@ user_to_service = db.Table(
|
||||
)
|
||||
|
||||
|
||||
BRANDING_GOVUK = 'govuk'
|
||||
BRANDING_ORG = 'org'
|
||||
BRANDING_BOTH = 'both'
|
||||
|
||||
|
||||
class BrandingTypes(db.Model):
|
||||
__tablename__ = 'branding_type'
|
||||
name = db.Column(db.String(255), primary_key=True)
|
||||
|
||||
|
||||
class Organisation(db.Model):
|
||||
__tablename__ = 'organisation'
|
||||
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
colour = db.Column(db.String(7), nullable=True)
|
||||
logo = db.Column(db.String(255), nullable=True)
|
||||
name = db.Column(db.String(255), nullable=True)
|
||||
|
||||
|
||||
class Service(db.Model, Versioned):
|
||||
__tablename__ = 'services'
|
||||
|
||||
@@ -104,6 +122,15 @@ class Service(db.Model, Versioned):
|
||||
created_by_id = db.Column(UUID(as_uuid=True), db.ForeignKey('users.id'), index=True, nullable=False)
|
||||
reply_to_email_address = db.Column(db.Text, index=False, unique=False, nullable=True)
|
||||
sms_sender = db.Column(db.String(11), nullable=True)
|
||||
organisation_id = db.Column(UUID(as_uuid=True), db.ForeignKey('organisation.id'), index=True, nullable=True)
|
||||
organisation = db.relationship('Organisation')
|
||||
branding = db.Column(
|
||||
db.String(255),
|
||||
db.ForeignKey('branding_type.name'),
|
||||
index=True,
|
||||
nullable=False,
|
||||
default=BRANDING_GOVUK
|
||||
)
|
||||
|
||||
|
||||
class ApiKey(db.Model, Versioned):
|
||||
|
||||
Reference in New Issue
Block a user