add new service whitelist table

services can have a whitelist of phone numbers and email addresses that they
can send to in addition to team members when in trial mode. email_address
and mobile_number are nullable and app level checks will be in place to
prevent inserting blank rows. they have a created_at date so that we can
[potentially] delete them a week later to avoid keeping personally identifying
data any longer than necessary
This commit is contained in:
Leo Hemsted
2016-09-20 15:41:53 +01:00
parent 0c5720108d
commit 3d0df9b5a7
2 changed files with 42 additions and 0 deletions

View File

@@ -132,6 +132,17 @@ class Service(db.Model, Versioned):
)
class ServiceWhitelist(db.Model):
__tablename__ = 'service_whitelist'
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
service_id = db.Column(UUID(as_uuid=True), db.ForeignKey('services.id'), index=True, nullable=False)
service = db.relationship('Service', backref='whitelist')
email_address = db.Column(db.String(255), nullable=True)
mobile_number = db.Column(db.String, nullable=True)
created_at = db.Column(db.DateTime, default=datetime.datetime.utcnow)
class ApiKey(db.Model, Versioned):
__tablename__ = 'api_keys'