random route stuff

This commit is contained in:
Josh Harvey 2016-12-21 19:51:20 +02:00
parent d27ff64a74
commit 9a63772401
8 changed files with 143 additions and 124 deletions

View file

@ -43,8 +43,8 @@ function authorizeCaDownload (caToken) {
function isPaired (deviceId) {
const sql = 'select device_id from devices where device_id=$1 and paired=TRUE'
return db.one(sql, [deviceId])
.then(() => true)
return db.oneOrNone(sql, [deviceId])
.then(row => row && row.device_id === deviceId)
}
module.exports = {pair, authorizeCaDownload, isPaired}