feat: add aveiro cash units to the devices table

feat: change data fetching to accomodate the new cash units
This commit is contained in:
Sérgio Salgado 2023-04-16 23:42:34 +01:00
parent 06f534fa48
commit 211c4b1ea7
19 changed files with 1011 additions and 155 deletions

View file

@ -19,8 +19,8 @@ const resolvers = {
unpairedMachines: () => machineLoader.getUnpairedMachines()
},
Mutation: {
machineAction: (...[, { deviceId, action, cashbox, cassette1, cassette2, cassette3, cassette4, newName }, context]) =>
machineAction({ deviceId, action, cashbox, cassette1, cassette2, cassette3, cassette4, newName }, context)
machineAction: (...[, { deviceId, action, cashUnits, newName }, context]) =>
machineAction({ deviceId, action, cashUnits, newName }, context)
}
}

View file

@ -14,11 +14,7 @@ const typeDef = gql`
pairedAt: Date
version: String
model: String
cashbox: Int
cassette1: Int
cassette2: Int
cassette3: Int
cassette4: Int
cashUnits: CashUnits
numberOfCassettes: Int
statuses: [MachineStatus]
latestEvent: MachineEvent
@ -27,6 +23,34 @@ const typeDef = gql`
packetLoss: String
}
type CashUnits {
cashbox: Int
cassette1: Int
cassette2: Int
cassette3: Int
cassette4: Int
stacker1f: Int
stacker1r: Int
stacker2f: Int
stacker2r: Int
stacker3f: Int
stacker3r: Int
}
input CashUnitsInput {
cashbox: Int
cassette1: Int
cassette2: Int
cassette3: Int
cassette4: Int
stacker1f: Int
stacker1r: Int
stacker2f: Int
stacker2r: Int
stacker3f: Int
stacker3r: Int
}
type UnpairedMachine {
id: ID!
deviceId: ID!
@ -64,7 +88,7 @@ const typeDef = gql`
}
type Mutation {
machineAction(deviceId:ID!, action: MachineAction!, cashbox: Int, cassette1: Int, cassette2: Int, cassette3: Int, cassette4: Int, newName: String): Machine @auth
machineAction(deviceId:ID!, action: MachineAction!, cashUnits: CashUnitsInput, newName: String): Machine @auth
}
`