Merge pull request #1099 from chaotixkilla/fix-custom-sms

Get SMS notices closer to spec
This commit is contained in:
Rafael Taranto 2022-02-16 10:09:18 +00:00 committed by GitHub
commit 26bf036553
19 changed files with 709 additions and 468 deletions

View file

@ -0,0 +1,22 @@
var db = require('./db')
var smsNotices = require('../lib/sms-notices')
exports.up = function (next) {
var sql = [
`ALTER TABLE custom_messages RENAME TO sms_notices`,
`ALTER TYPE custom_message_event RENAME TO sms_notice_event`,
`ALTER TYPE sms_notice_event ADD VALUE 'sms_receipt'`,
`ALTER TABLE sms_notices ADD COLUMN message_name TEXT UNIQUE NOT NULL`,
`ALTER TABLE sms_notices ADD COLUMN enabled BOOLEAN NOT NULL DEFAULT true`
`ALTER TABLE sms_notices ADD COLUMN allow_toggle BOOLEAN NOT NULL DEFAULT true`
]
db.multi(sql, next)
.then(() => smsNotices.createSMSNotice('sms_code', 'SMS confirmation code', 'Your cryptomat code: #code', true, false))
.then(() => smsNotices.createSMSNotice('cash_out_dispense_ready', 'Cash is ready', 'Your cash is waiting! Go to the Cryptomat and press Redeem within 24 hours. [#timestamp]', true, false))
.then(() => smsNotices.createSMSNotice('sms_receipt', 'SMS receipt', '', true, true))
}
exports.down = function (next) {
next()
}