chore: server code formatting

This commit is contained in:
Rafael Taranto 2025-05-12 15:35:00 +01:00
parent aedabcbdee
commit 68517170e2
234 changed files with 9824 additions and 6195 deletions

View file

@ -4,16 +4,13 @@ const router = express.Router()
const cashbox = require('../cashbox-batches')
const notifier = require('../notifier')
const { getMachine, setMachine, getMachineName } = require('../machine-loader')
const { getMachine, getMachineName } = require('../machine-loader')
const { loadLatestConfig } = require('../new-settings-loader')
const { getCashInSettings } = require('../new-config-manager')
const { AUTOMATIC } = require('../constants')
const logger = require('../logger')
function cashboxRemoval (req, res, next) {
const operatorId = res.locals.operatorId
function cashboxRemoval(req, res, next) {
notifier.cashboxNotify(req.deviceId).catch(logger.error)
return Promise.all([getMachine(req.deviceId), loadLatestConfig()])
@ -22,16 +19,23 @@ function cashboxRemoval (req, res, next) {
if (cashInSettings.cashboxReset !== AUTOMATIC) {
return Promise.all([
cashbox.getMachineUnbatchedBills(req.deviceId),
getMachineName(req.deviceId)
getMachineName(req.deviceId),
])
}
return cashbox.createCashboxBatch(req.deviceId, machine.cashbox)
.then(batch => Promise.all([
cashbox.getBatchById(batch.id),
getMachineName(batch.device_id)
]))
return cashbox
.createCashboxBatch(req.deviceId, machine.cashbox)
.then(batch =>
Promise.all([
cashbox.getBatchById(batch.id),
getMachineName(batch.device_id),
]),
)
})
.then(([batch, machineName]) => res.status(200).send({ batch: _.merge(batch, { machineName }), status: 'OK' }))
.then(([batch, machineName]) =>
res
.status(200)
.send({ batch: _.merge(batch, { machineName }), status: 'OK' }),
)
.catch(next)
}