refactor: rename cash box/cassette batch operations type
This commit is contained in:
parent
f7c7d52a93
commit
3213513f54
3 changed files with 15 additions and 15 deletions
|
|
@ -5,8 +5,8 @@ const uuid = require('uuid')
|
|||
|
||||
function createCashboxBatch (deviceId, cashboxCount) {
|
||||
if (_.isEqual(0, cashboxCount)) throw new Error('Cashbox is empty. Cashbox batch could not be created.')
|
||||
const sql = `INSERT INTO cashbox_batches (id, device_id, created, operation_type) VALUES ($1, $2, now(), 'cash-in-empty') RETURNING *`
|
||||
const sql2 = `
|
||||
const sql = `INSERT INTO cashbox_batches (id, device_id, created, operation_type) VALUES ($1, $2, now(), 'cash-box-empty') RETURNING *`
|
||||
const sql2 = `
|
||||
UPDATE bills SET cashbox_batch_id=$1
|
||||
FROM cash_in_txs
|
||||
WHERE bills.cash_in_txs_id = cash_in_txs.id AND
|
||||
|
|
@ -29,7 +29,7 @@ function updateMachineWithBatch (machineContext, oldCashboxCount) {
|
|||
return db.tx(t => {
|
||||
const deviceId = machineContext.deviceId
|
||||
const batchId = uuid.v4()
|
||||
const q1 = t.none(`INSERT INTO cashbox_batches (id, device_id, created, operation_type) VALUES ($1, $2, now(), 'cash-in-empty')`, [batchId, deviceId])
|
||||
const q1 = t.none(`INSERT INTO cashbox_batches (id, device_id, created, operation_type) VALUES ($1, $2, now(), 'cash-box-empty')`, [batchId, deviceId])
|
||||
const q2 = t.none(`UPDATE bills SET cashbox_batch_id=$1 FROM cash_in_txs
|
||||
WHERE bills.cash_in_txs_id = cash_in_txs.id AND
|
||||
cash_in_txs.device_id = $2 AND
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@ var db = require('./db')
|
|||
exports.up = function (next) {
|
||||
var sqls = [
|
||||
`CREATE TYPE cashbox_batch_type AS ENUM(
|
||||
'cash-in-empty',
|
||||
'cash-out-1-refill',
|
||||
'cash-out-1-empty',
|
||||
'cash-out-2-refill',
|
||||
'cash-out-2-empty',
|
||||
'cash-out-3-refill',
|
||||
'cash-out-3-empty',
|
||||
'cash-out-4-refill',
|
||||
'cash-out-4-empty'
|
||||
'cash-box-empty',
|
||||
'cash-cassette-1-refill',
|
||||
'cash-cassette-1-empty',
|
||||
'cash-cassette-2-refill',
|
||||
'cash-cassette-2-empty',
|
||||
'cash-cassette-3-refill',
|
||||
'cash-cassette-3-empty',
|
||||
'cash-cassette-4-refill',
|
||||
'cash-cassette-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`,
|
||||
|
|
|
|||
|
|
@ -93,14 +93,14 @@ const CashboxHistory = ({ machines, currency }) => {
|
|||
(ret, i) =>
|
||||
R.pipe(
|
||||
R.assoc(
|
||||
`cash-out-${i}-refill`,
|
||||
`cash-cassette-${i}-refill`,
|
||||
<>
|
||||
<TxOutIcon />
|
||||
<span className={classes.operationType}>Cash-out {i} refill</span>
|
||||
</>
|
||||
),
|
||||
R.assoc(
|
||||
`cash-out-${i}-empty`,
|
||||
`cash-cassette-${i}-empty`,
|
||||
<>
|
||||
<TxOutIcon />
|
||||
<span className={classes.operationType}>Cash-out {i} emptied</span>
|
||||
|
|
@ -108,7 +108,7 @@ const CashboxHistory = ({ machines, currency }) => {
|
|||
)
|
||||
)(ret),
|
||||
{
|
||||
'cash-in-empty': (
|
||||
'cash-box-empty': (
|
||||
<>
|
||||
<TxInIcon />
|
||||
<span className={classes.operationType}>Cash-in emptied</span>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue