mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
create, edit and use email branding instead of organisation
notable things that have been kept until migration is complete: * passing in `organisation` to update_service will update email branding * both `/email-branding` and `/organisation` hit the same code * service endpoints still return organisation as well as email branding
This commit is contained in:
23
app/dao/email_branding_dao.py
Normal file
23
app/dao/email_branding_dao.py
Normal file
@@ -0,0 +1,23 @@
|
||||
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()
|
||||
|
||||
|
||||
@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)
|
||||
db.session.add(email_branding)
|
||||
@@ -1,23 +0,0 @@
|
||||
from app import db
|
||||
from app.dao.dao_utils import transactional
|
||||
from app.models import Organisation
|
||||
|
||||
|
||||
def dao_get_organisations():
|
||||
return Organisation.query.all()
|
||||
|
||||
|
||||
def dao_get_organisation_by_id(org_id):
|
||||
return Organisation.query.filter_by(id=org_id).one()
|
||||
|
||||
|
||||
@transactional
|
||||
def dao_create_organisation(organisation):
|
||||
db.session.add(organisation)
|
||||
|
||||
|
||||
@transactional
|
||||
def dao_update_organisation(organisation, **kwargs):
|
||||
for key, value in kwargs.items():
|
||||
setattr(organisation, key, value)
|
||||
db.session.add(organisation)
|
||||
Reference in New Issue
Block a user