mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-16 20:48:37 -04:00
Add versioning to Organisations
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from app import db
|
||||
from app.dao.dao_utils import transactional
|
||||
from app.dao.dao_utils import transactional, version_class
|
||||
from app.models import Organisation
|
||||
|
||||
|
||||
@@ -12,10 +12,12 @@ def dao_get_organisation_by_id(org_id):
|
||||
|
||||
|
||||
@transactional
|
||||
@version_class(Organisation)
|
||||
def dao_create_organisation(organisation):
|
||||
db.session.add(organisation)
|
||||
|
||||
|
||||
@transactional
|
||||
@version_class(Organisation)
|
||||
def dao_update_organisation(organisation):
|
||||
db.session.add(organisation)
|
||||
|
||||
@@ -130,7 +130,7 @@ class BrandingTypes(db.Model):
|
||||
name = db.Column(db.String(255), primary_key=True)
|
||||
|
||||
|
||||
class Organisation(db.Model):
|
||||
class Organisation(db.Model, Versioned):
|
||||
__tablename__ = 'organisation'
|
||||
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
colour = db.Column(db.String(7), nullable=True)
|
||||
@@ -142,8 +142,7 @@ class Organisation(db.Model):
|
||||
"""
|
||||
Assumption: data has been validated appropriately.
|
||||
|
||||
Returns a Service object based on the provided data. Deserialises created_by to created_by_id as marshmallow
|
||||
would.
|
||||
Returns a Organisation object based on the provided data.
|
||||
"""
|
||||
# validate json with marshmallow
|
||||
fields = data.copy()
|
||||
|
||||
Reference in New Issue
Block a user