add inbound sms api

two endpoints:
* get all inbound sms for a service (you can limit to the X most
  recent, or filter by user's phone number [which will be normalised])
* get a summary of inbound sms for a service - returns the count of
  inbound sms in the database, and the date that the most recent was
  sent
This commit is contained in:
Leo Hemsted
2017-05-31 14:49:14 +01:00
parent d89cb2c120
commit ef52337d85
9 changed files with 255 additions and 0 deletions

View File

@@ -1175,6 +1175,18 @@ class InboundSms(db.Model):
def content(self, content):
self._content = encryption.encrypt(content)
def serialize(self):
return {
'id': str(self.id),
'created_at': self.created_at.isoformat(),
'service_id': str(self.service_id),
'notify_number': self.notify_number,
'user_number': self.user_number,
'content': self.content,
'provider_date': self.provider_date and self.provider_date.isoformat(),
'provider_reference': self.provider_reference
}
class LetterRate(db.Model):
__tablename__ = 'letter_rates'