Files
notifications-api/app/dao/email_branding_dao.py
Chris Hill-Scott 5a7de22f55 Set default branding for NHS services
The NHS is a special case because it’s not one organisation, but it does
have one consistent brand. So anyone working for an NHS organisation
should have their default branding set when they create a service, even
if we know nothing about their specific organisation.
2019-04-08 10:27:26 +01:00

28 lines
733 B
Python

from app import db
from app.dao.dao_utils import transactional
from app.models import EmailBranding
def dao_get_email_branding_options():
return EmailBranding.query.all()
def dao_get_email_branding_by_id(email_branding_id):
return EmailBranding.query.filter_by(id=email_branding_id).one()
def dao_get_email_branding_by_name(email_branding_name):
return EmailBranding.query.filter_by(name=email_branding_name).first()
@transactional
def dao_create_email_branding(email_branding):
db.session.add(email_branding)
@transactional
def dao_update_email_branding(email_branding, **kwargs):
for key, value in kwargs.items():
setattr(email_branding, key, value or None)
db.session.add(email_branding)