implement SNS

This commit is contained in:
Jim Moffet
2022-06-17 11:16:23 -07:00
parent 79ba6cc1d1
commit aa4ec532a4
17 changed files with 218 additions and 351 deletions

View File

@@ -18,14 +18,14 @@ def upgrade():
op.create_table('provider_rates',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('valid_from', sa.DateTime(), nullable=False),
sa.Column('provider', sa.Enum('mmg', 'twilio', 'firetext', 'ses', name='providers'), nullable=False),
sa.Column('provider', sa.Enum('mmg', 'twilio', 'firetext', 'ses', 'sns', name='providers'), nullable=False),
sa.Column('rate', sa.Numeric(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_table('provider_statistics',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('day', sa.Date(), nullable=False),
sa.Column('provider', sa.Enum('mmg', 'twilio', 'firetext', 'ses', name='providers'), nullable=False),
sa.Column('provider', sa.Enum('mmg', 'twilio', 'firetext', 'ses', 'sns', name='providers'), nullable=False),
sa.Column('service_id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('unit_count', sa.BigInteger(), nullable=False),
sa.ForeignKeyConstraint(['service_id'], ['services.id'], ),

View File

@@ -43,6 +43,9 @@ def upgrade():
op.execute(
"INSERT INTO provider_details (id, display_name, identifier, priority, notification_type, active) values ('{}', 'AWS SES', 'ses', 10, 'email', true)".format(str(uuid.uuid4()))
)
op.execute(
"INSERT INTO provider_details (id, display_name, identifier, priority, notification_type, active) values ('{}', 'AWS SNS', 'sns', 10, 'sms', true)".format(str(uuid.uuid4()))
)
op.execute(
"UPDATE provider_rates set provider_id = (select id from provider_details where identifier = 'mmg') where provider = 'mmg'"
)
@@ -52,6 +55,9 @@ def upgrade():
op.execute(
"UPDATE provider_rates set provider_id = (select id from provider_details where identifier = 'ses') where provider = 'ses'"
)
op.execute(
"UPDATE provider_rates set provider_id = (select id from provider_details where identifier = 'sns') where provider = 'sns'"
)
op.execute(
"UPDATE provider_statistics set provider_id = (select id from provider_details where identifier = 'mmg') where provider = 'mmg'"
)
@@ -61,6 +67,9 @@ def upgrade():
op.execute(
"UPDATE provider_statistics set provider_id = (select id from provider_details where identifier = 'ses') where provider = 'ses'"
)
op.execute(
"UPDATE provider_statistics set provider_id = (select id from provider_details where identifier = 'sns') where provider = 'sns'"
)
def downgrade():

View File

@@ -73,7 +73,7 @@ def upgrade():
'email', datetime.utcnow(), invitation_content, service_id,
invitation_subject, user_id))
sms_code_content = '((verify_code)) is your Notify authentication code'
sms_code_content = '((verify_code)) is your US Notify authentication code'
op.execute(template_history_insert.format('36fb0730-6259-4da1-8a80-c8de22ad4246', 'Notify SMS verify code',
'sms', datetime.utcnow(), sms_code_content, service_id, None, user_id))

View File

@@ -76,7 +76,7 @@ def upgrade():
)
)
mobile_template_content = """Your mobile number was changed by ((servicemanagername)). Next time you sign in, your Notify authentication code will be sent to this phone."""
mobile_template_content = """Your mobile number was changed by ((servicemanagername)). Next time you sign in, your US Notify authentication code will be sent to this phone."""
mobile_template_name = "Phone number changed by service manager"