fix: readd the notification sending function
This commit is contained in:
parent
4015e23d34
commit
80d7d7184e
2 changed files with 12 additions and 18 deletions
|
|
@ -2,6 +2,7 @@ const express = require('express')
|
|||
const router = express.Router()
|
||||
|
||||
const cashbox = require('../cashbox-batches')
|
||||
const notifier = require('../notifier')
|
||||
const { getMachine, setMachine } = require('../machine-loader')
|
||||
const { loadLatestConfig } = require('../new-settings-loader')
|
||||
const { getCashInSettings } = require('../new-config-manager')
|
||||
|
|
@ -9,7 +10,9 @@ const { AUTOMATIC } = require('../constants.js')
|
|||
|
||||
function notifyCashboxRemoval (req, res, next) {
|
||||
const operatorId = res.locals.operatorId
|
||||
return Promise.all([getMachine(req.deviceId), loadLatestConfig()])
|
||||
|
||||
return notifier.cashboxNotify(req.deviceId)
|
||||
.then(() => Promise.all([getMachine(req.deviceId), loadLatestConfig()]))
|
||||
.then(([machine, config]) => {
|
||||
const cashInSettings = getCashInSettings(config)
|
||||
if (cashInSettings.cashboxReset !== AUTOMATIC) {
|
||||
|
|
|
|||
|
|
@ -6,25 +6,16 @@ exports.up = function (next) {
|
|||
`ALTER TYPE notification_type ADD VALUE 'security'`
|
||||
]
|
||||
|
||||
return loadLatest()
|
||||
.then(config => {
|
||||
const newConfig = {}
|
||||
if(config.notifications_email_active) {
|
||||
newConfig.notifications_email_security = true
|
||||
}
|
||||
if(config.notifications_sms_active) {
|
||||
newConfig.notifications_sms_security = true
|
||||
}
|
||||
if(config.notifications_notificationCenter_active) {
|
||||
newConfig.notifications_notificationCenter_security = true
|
||||
}
|
||||
|
||||
return migrationSaveConfig(newConfig)
|
||||
.then(() => db.multi(sql, next))
|
||||
.catch(err => {
|
||||
return next(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
module.exports.down = function (next) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue