Add organisations model and create dao

This commit is contained in:
Ken Tsang
2017-07-04 17:02:28 +01:00
parent a01163d719
commit c743e52fe8
5 changed files with 72 additions and 3 deletions

View File

@@ -137,6 +137,19 @@ class Organisation(db.Model):
logo = db.Column(db.String(255), nullable=True)
name = db.Column(db.String(255), nullable=True)
@classmethod
def from_json(cls, data):
"""
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.
"""
# validate json with marshmallow
fields = data.copy()
return cls(**fields)
DVLA_ORG_HM_GOVERNMENT = '001'
DVLA_ORG_LAND_REGISTRY = '500'