Merge remote-tracking branch 'upstream/release-7.5.0' into chore/merge-release-into-dev
This commit is contained in:
commit
0ad2ee362a
109 changed files with 3283 additions and 697 deletions
|
|
@ -7,7 +7,11 @@ exports.up = function (next) {
|
|||
'cash-out-1-refill',
|
||||
'cash-out-1-empty',
|
||||
'cash-out-2-refill',
|
||||
'cash-out-2-empty'
|
||||
'cash-out-2-empty',
|
||||
'cash-out-3-refill',
|
||||
'cash-out-3-empty',
|
||||
'cash-out-4-refill',
|
||||
'cash-out-4-empty'
|
||||
)`,
|
||||
`ALTER TABLE cashbox_batches ADD COLUMN operation_type cashbox_batch_type NOT NULL`,
|
||||
`ALTER TABLE cashbox_batches ADD COLUMN bill_count_override SMALLINT`,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ exports.up = function (next) {
|
|||
.then(({ config }) => {
|
||||
const fiatBalance1 = config.notifications_fiatBalanceCassette1
|
||||
const fiatBalance2 = config.notifications_fiatBalanceCassette2
|
||||
const fiatBalance3 = config.notifications_fiatBalanceCassette3
|
||||
const fiatBalance4 = config.notifications_fiatBalanceCassette4
|
||||
const overrides = config.notifications_fiatBalanceOverrides
|
||||
const newConfig = {}
|
||||
if (fiatBalance1) {
|
||||
|
|
@ -17,6 +19,14 @@ exports.up = function (next) {
|
|||
newConfig.notifications_fillingPercentageCassette2 = (100 * (fiatBalance2 / cassetteMaxCapacity)).toFixed(0)
|
||||
newConfig.notifications_fiatBalanceCassette2 = null
|
||||
}
|
||||
if (fiatBalance3) {
|
||||
newConfig.notifications_fillingPercentageCassette3 = (100 * (fiatBalance3 / cassetteMaxCapacity)).toFixed(0)
|
||||
newConfig.notifications_fiatBalanceCassette3 = null
|
||||
}
|
||||
if (fiatBalance4) {
|
||||
newConfig.notifications_fillingPercentageCassette4 = (100 * (fiatBalance4 / cassetteMaxCapacity)).toFixed(0)
|
||||
newConfig.notifications_fiatBalanceCassette4 = null
|
||||
}
|
||||
|
||||
if (overrides) {
|
||||
newConfig.notifications_fiatBalanceOverrides = _.map(override => {
|
||||
|
|
@ -27,6 +37,12 @@ exports.up = function (next) {
|
|||
if (override.fiatBalanceCassette2) {
|
||||
newOverride.fillingPercentageCassette2 = (100 * (override.fiatBalanceCassette2 / cassetteMaxCapacity)).toFixed(0)
|
||||
}
|
||||
if (override.fiatBalanceCassette3) {
|
||||
newOverride.fillingPercentageCassette3 = (100 * (override.fiatBalanceCassette3 / cassetteMaxCapacity)).toFixed(0)
|
||||
}
|
||||
if (override.fiatBalanceCassette4) {
|
||||
newOverride.fillingPercentageCassette4 = (100 * (override.fiatBalanceCassette4 / cassetteMaxCapacity)).toFixed(0)
|
||||
}
|
||||
newOverride.machine = override.machine
|
||||
newOverride.id = override.id
|
||||
|
||||
|
|
|
|||
48
migrations/1630432869178-add-more-cassette-support.js
Normal file
48
migrations/1630432869178-add-more-cassette-support.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
var db = require('./db')
|
||||
const _ = require('lodash/fp')
|
||||
const { saveConfig, loadLatest } = require('../lib/new-settings-loader')
|
||||
const { getMachines } = require('../lib/machine-loader')
|
||||
|
||||
exports.up = function (next) {
|
||||
var sql = [
|
||||
'ALTER TABLE devices ADD COLUMN cassette3 INTEGER NOT NULL DEFAULT 0',
|
||||
'ALTER TABLE devices ADD COLUMN cassette4 INTEGER NOT NULL DEFAULT 0',
|
||||
'ALTER TABLE cash_out_txs ADD COLUMN provisioned_3 INTEGER',
|
||||
'ALTER TABLE cash_out_txs ADD COLUMN provisioned_4 INTEGER',
|
||||
'ALTER TABLE cash_out_txs ADD COLUMN denomination_3 INTEGER',
|
||||
'ALTER TABLE cash_out_txs ADD COLUMN denomination_4 INTEGER',
|
||||
'ALTER TABLE cash_out_actions ADD COLUMN provisioned_3 INTEGER',
|
||||
'ALTER TABLE cash_out_actions ADD COLUMN provisioned_4 INTEGER',
|
||||
'ALTER TABLE cash_out_actions ADD COLUMN dispensed_3 INTEGER',
|
||||
'ALTER TABLE cash_out_actions ADD COLUMN dispensed_4 INTEGER',
|
||||
'ALTER TABLE cash_out_actions ADD COLUMN rejected_3 INTEGER',
|
||||
'ALTER TABLE cash_out_actions ADD COLUMN rejected_4 INTEGER',
|
||||
'ALTER TABLE cash_out_actions ADD COLUMN denomination_3 INTEGER',
|
||||
'ALTER TABLE cash_out_actions ADD COLUMN denomination_4 INTEGER',
|
||||
'ALTER TABLE devices ADD COLUMN number_of_cassettes INTEGER NOT NULL DEFAULT 2'
|
||||
]
|
||||
|
||||
return Promise.all([loadLatest(), getMachines()])
|
||||
.then(([config, machines]) => {
|
||||
const formattedMachines = _.map(it => _.pick(['deviceId'], it), machines)
|
||||
const newConfig = _.reduce((acc, value) => {
|
||||
if(_.includes(`cashOut_${value.deviceId}_top`, _.keys(config.config))) {
|
||||
acc[`cashOut_${value.deviceId}_cassette1`] = config.config[`cashOut_${value.deviceId}_top`]
|
||||
}
|
||||
|
||||
if(_.includes(`cashOut_${value.deviceId}_bottom`, _.keys(config.config))) {
|
||||
acc[`cashOut_${value.deviceId}_cassette2`] = config.config[`cashOut_${value.deviceId}_bottom`]
|
||||
}
|
||||
|
||||
return acc
|
||||
}, {}, formattedMachines)
|
||||
|
||||
return saveConfig(newConfig)
|
||||
.then(() => db.multi(sql, next))
|
||||
.catch(err => next(err))
|
||||
})
|
||||
}
|
||||
|
||||
exports.down = function (next) {
|
||||
next()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue