Add a new table to store the api information for a service inbound sms message.

Including:
 - url to push the inbound sms to
 - bearer_token to be added to the header of the request.

The services will be expected to manage these properties.
This commit is contained in:
Rebecca Law
2017-06-13 15:27:13 +01:00
parent 0596b210a5
commit b186cad046
4 changed files with 74 additions and 0 deletions

View File

@@ -295,6 +295,19 @@ class ServiceWhitelist(db.Model):
return 'Recipient {} of type: {}'.format(self.recipient, self.recipient_type)
class ServiceInboundApi(db.Model):
__tablename__ = 'service_inbound_api'
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')
url = db.Column(db.String(255), nullable=False)
bearer_token = db.Column(db.String(255), nullable=False)
@property
def unsigned_bearer_token(self):
return get_secret(self.bearer_token)
class ApiKey(db.Model, Versioned):
__tablename__ = 'api_keys'