From d1d49105555742bf7baae00efa11cae29bd8b44a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Oliveira?= Date: Mon, 10 May 2021 22:55:21 +0100 Subject: [PATCH] feat: add reset settings to user config --- ...620680439585-add-cashbox-reset-settings.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 migrations/1620680439585-add-cashbox-reset-settings.js diff --git a/migrations/1620680439585-add-cashbox-reset-settings.js b/migrations/1620680439585-add-cashbox-reset-settings.js new file mode 100644 index 00000000..b3c1ac33 --- /dev/null +++ b/migrations/1620680439585-add-cashbox-reset-settings.js @@ -0,0 +1,23 @@ +const { saveConfig, loadLatest } = require('../lib/new-settings-loader') + +exports.up = function (next) { + const newConfig = { + cashIn_automaticCashboxReset: false + } + return loadLatest() + .then(config => { + return saveConfig(newConfig) + .then(() => next()) + .catch(err => { + if (err.message === 'lamassu-server is not configured') { + return next() + } + console.log(err.message) + return next(err) + }) + }) +} + +module.exports.down = function (next) { + next() +}