feat: add unpaired machines endpoint to GraphQL

This commit is contained in:
André Sá 2022-03-11 15:13:08 +00:00
parent 986df24864
commit 0f93e313b6
3 changed files with 23 additions and 1 deletions

View file

@ -15,7 +15,8 @@ const resolvers = {
},
Query: {
machines: () => machineLoader.getMachineNames(),
machine: (...[, { deviceId }]) => machineLoader.getMachine(deviceId)
machine: (...[, { deviceId }]) => machineLoader.getMachine(deviceId),
unpairedMachines: () => machineLoader.getUnpairedMachines()
},
Mutation: {
machineAction: (...[, { deviceId, action, cashbox, cassette1, cassette2, cassette3, cassette4, newName }, context]) =>

View file

@ -27,6 +27,15 @@ const typeDef = gql`
packetLoss: String
}
type UnpairedMachine {
id: ID!
deviceId: ID!
name: String
model: String
paired: Date!
unpaired: Date!
}
type MachineEvent {
id: ID
deviceId: String
@ -51,6 +60,7 @@ const typeDef = gql`
type Query {
machines: [Machine] @auth
machine(deviceId: ID!): Machine @auth
unpairedMachines: [UnpairedMachine!]! @auth
}
type Mutation {