Merge pull request #373 from mautematico/feat-add-cashboxes-screen
feat: add cashboxes screen
This commit is contained in:
commit
d7ff61d83f
11 changed files with 500 additions and 8 deletions
|
|
@ -207,6 +207,7 @@ const typeDefs = gql`
|
|||
}
|
||||
|
||||
enum MachineAction {
|
||||
emptyCashInBills
|
||||
resetCashOutBills
|
||||
unpair
|
||||
reboot
|
||||
|
|
@ -214,7 +215,7 @@ const typeDefs = gql`
|
|||
}
|
||||
|
||||
type Mutation {
|
||||
machineAction(deviceId:ID!, action: MachineAction!): Machine
|
||||
machineAction(deviceId:ID!, action: MachineAction!, cassettes: [Int]): Machine
|
||||
machineSupportLogs(deviceId: ID!): SupportLogsResponse
|
||||
serverSupportLogs: SupportLogsResponse
|
||||
setCustomer(customerId: ID!, customerInput: CustomerInput): Customer
|
||||
|
|
@ -254,7 +255,7 @@ const resolvers = {
|
|||
accounts: () => settingsLoader.getAccounts()
|
||||
},
|
||||
Mutation: {
|
||||
machineAction: (...[, { deviceId, action }]) => machineAction({ deviceId, action }),
|
||||
machineAction: (...[, { deviceId, action, cassettes }]) => machineAction({ deviceId, action, cassettes }),
|
||||
machineSupportLogs: (...[, { deviceId }]) => supportLogs.insert(deviceId),
|
||||
createPairingTotem: (...[, { name }]) => pairing.totem(name),
|
||||
serverSupportLogs: () => serverLogs.insert(),
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ function getMachine (machineId) {
|
|||
.then(machines => machines.find(({ deviceId }) => deviceId === machineId))
|
||||
}
|
||||
|
||||
function machineAction ({ deviceId, action }) {
|
||||
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 }))
|
||||
.then(machineLoader.setMachine({ deviceId, action, cassettes }))
|
||||
.then(getMachine(deviceId))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue