This is the first deploy in series of deploys to give certain templates priority in processing.

If the template is marked as priority the notification will be sent using the `notify` queue.
The `notify` queue is a low volume queue, messages here will not be queue behind a large job and should be delivered with in a more consistent time frame.

- Added templates.process_type and templates_history.process_type column.
- Added a template_process_type table to handle the enum for templates.process_type, initial values are normal and priority

https://www.pivotaltracker.com/story/show/135429147
This commit is contained in:
Rebecca Law
2017-01-13 12:14:34 +00:00
parent d759842adc
commit 6c79ddbe41
4 changed files with 63 additions and 3 deletions

View File

@@ -258,6 +258,11 @@ class NotificationStatistics(db.Model):
)
class TemplateProcessTypes(db.Model):
__tablename__ = 'template_process_type'
name = db.Column(db.String(255), primary_key=True)
SMS_TYPE = 'sms'
EMAIL_TYPE = 'email'
LETTER_TYPE = 'letter'
@@ -266,6 +271,10 @@ TEMPLATE_TYPES = [SMS_TYPE, EMAIL_TYPE, LETTER_TYPE]
template_types = db.Enum(*TEMPLATE_TYPES, name='template_type')
NORMAL = 'normal'
PRIORITY = 'priority'
TEMPLATE_PROCESS_TYPE = [NORMAL, PRIORITY]
class Template(db.Model):
__tablename__ = 'templates'
@@ -293,6 +302,11 @@ class Template(db.Model):
created_by_id = db.Column(UUID(as_uuid=True), db.ForeignKey('users.id'), index=True, nullable=False)
created_by = db.relationship('User')
version = db.Column(db.Integer, default=1, nullable=False)
process_type = db.Column(db.String(255),
db.ForeignKey('template_process_type.name'),
index=True,
nullable=True,
default=NORMAL)
def get_link(self):
# TODO: use "/v2/" route once available
@@ -320,7 +334,11 @@ class TemplateHistory(db.Model):
created_by_id = db.Column(UUID(as_uuid=True), db.ForeignKey('users.id'), index=True, nullable=False)
created_by = db.relationship('User')
version = db.Column(db.Integer, primary_key=True, nullable=False)
process_type = db.Column(db.String(255),
db.ForeignKey('template_process_type.name'),
index=True,
nullable=True,
default=NORMAL)
MMG_PROVIDER = "mmg"
FIRETEXT_PROVIDER = "firetext"