chore: undo $ prepend on queries
This commit is contained in:
parent
f3f2bb01b0
commit
ba4117173e
50 changed files with 215 additions and 227 deletions
|
|
@ -9,7 +9,7 @@ function pullToken (token) {
|
|||
const sql = `delete from pairing_tokens
|
||||
where token=$1
|
||||
returning name, created < now() - interval '1 hour' as expired`
|
||||
return db.$one(sql, [token])
|
||||
return db.one(sql, [token])
|
||||
}
|
||||
|
||||
function unpair (deviceId) {
|
||||
|
|
@ -17,7 +17,7 @@ function unpair (deviceId) {
|
|||
const deleteMachinePings = 'delete from machine_pings where device_id=$1'
|
||||
|
||||
// TODO new-admin: We should remove all configs related to that device. This can get tricky.
|
||||
return Promise.all([db.$none(sql, [deviceId]), db.$none(deleteMachinePings, [deviceId])])
|
||||
return Promise.all([db.none(sql, [deviceId]), db.none(deleteMachinePings, [deviceId])])
|
||||
}
|
||||
|
||||
function pair (token, deviceId, machineModel) {
|
||||
|
|
@ -29,7 +29,7 @@ function pair (token, deviceId, machineModel) {
|
|||
on conflict (device_id)
|
||||
do update set paired=TRUE, display=TRUE`
|
||||
|
||||
return db.$none(insertSql, [deviceId, r.name])
|
||||
return db.none(insertSql, [deviceId, r.name])
|
||||
.then(() => true)
|
||||
})
|
||||
.catch(err => {
|
||||
|
|
@ -51,7 +51,7 @@ function authorizeCaDownload (caToken) {
|
|||
function isPaired (deviceId) {
|
||||
const sql = 'select device_id, name from devices where device_id=$1 and paired=TRUE'
|
||||
|
||||
return db.$oneOrNone(sql, [deviceId])
|
||||
return db.oneOrNone(sql, [deviceId])
|
||||
.then(row => row && row.device_id === deviceId ? row.name : false)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue