feat: add unpaired machines endpoint to GraphQL
This commit is contained in:
parent
986df24864
commit
0f93e313b6
3 changed files with 23 additions and 1 deletions
|
|
@ -43,6 +43,16 @@ function getMachines () {
|
|||
.then(rr => rr.map(toMachineObject))
|
||||
}
|
||||
|
||||
function getUnpairedMachines () {
|
||||
return db.any('SELECT * FROM unpaired_devices')
|
||||
.then(_.map(r =>
|
||||
_.flow(
|
||||
_.set('deviceId', _.get('device_id', r)),
|
||||
_.unset('device_id')
|
||||
)(r)
|
||||
))
|
||||
}
|
||||
|
||||
function getConfig (defaultConfig) {
|
||||
if (defaultConfig) return Promise.resolve(defaultConfig)
|
||||
|
||||
|
|
@ -257,6 +267,7 @@ function getNetworkHeartbeatByDevice (deviceId) {
|
|||
module.exports = {
|
||||
getMachineName,
|
||||
getMachines,
|
||||
getUnpairedMachines,
|
||||
getMachine,
|
||||
getMachineNames,
|
||||
setMachine,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue