refactor: move pairing.js:isPaired() to machine-loader.js:getPairedMachineName()
This commit is contained in:
parent
22b6b64fe4
commit
49080b0412
3 changed files with 11 additions and 13 deletions
|
|
@ -173,6 +173,13 @@ function getMachineName(machineId) {
|
|||
return db.oneOrNone(sql, [machineId]).then(it => it?.name)
|
||||
}
|
||||
|
||||
const getPairedMachineName = deviceId =>
|
||||
db.oneOrNone(
|
||||
'SELECT name FROM devices WHERE device_id = $1 AND paired = TRUE',
|
||||
[deviceId],
|
||||
machine => machine?.name,
|
||||
)
|
||||
|
||||
function getMachine(machineId, config) {
|
||||
const sql = `${MACHINE_WITH_CALCULATED_FIELD_SQL} WHERE d.device_id = $1`
|
||||
|
||||
|
|
@ -750,6 +757,7 @@ const batchRecordPendingPings = () => {
|
|||
|
||||
module.exports = {
|
||||
getMachineName,
|
||||
getPairedMachineName,
|
||||
getMachines,
|
||||
getUnpairedMachines,
|
||||
getMachine,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue