feat: add cashboxes route feat: add non-editable cashbox component feat: cashboxes action required icon feat: add cashOut denomination to cashboxes feat: edit cashboxes values feat: new server empty cashIn and reset cashOut actions feat: reset cashboxes from UI fix: cashbox border, cashbox font fix: move cashbox styles to its own file fix: use default table for cashboxes-table fix: better import fix: TODO: find a better way to display cashbox reset errors fix: TODO for cashout fix: move cashboxestable closer to parent fix: WIP use EditableTable instead of fakatable wip: move to editabletable fix: WIP split cashbox into view + input components that can be used with formik feat: rewrite cashbox component into view + fromik feat: WIP use editableTable instead of hand made table feat: WIP cashboxes editable table feat: split cashbox feat: Yup validation schema for cashboxes editable table feat: split cashbox into view+formik feat: WIP use editableTable instead of faketable feat: use editableTable instead of fakeTable fix: custom CashboxesTable not needed anymore
19 lines
636 B
JavaScript
19 lines
636 B
JavaScript
const machineLoader = require('../machine-loader')
|
|
const { UserInputError } = require('apollo-server-express')
|
|
|
|
function getMachine (machineId) {
|
|
return machineLoader.getMachines()
|
|
.then(machines => machines.find(({ deviceId }) => deviceId === machineId))
|
|
}
|
|
|
|
function machineAction ({ deviceId, action, cassettes }) {
|
|
return getMachine(deviceId)
|
|
.then(machine => {
|
|
if (!machine) throw new UserInputError(`machine:${deviceId} not found`, { deviceId })
|
|
return machine
|
|
})
|
|
.then(machineLoader.setMachine({ deviceId, action, cassettes }))
|
|
.then(getMachine(deviceId))
|
|
}
|
|
|
|
module.exports = { machineAction }
|