1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 02:09:32 +02:00

Add convenience flags for knowing if a device is usable, ready, and owned by us.

This commit is contained in:
Simo Kinnunen 2014-03-18 15:06:02 +09:00
parent cc42b7c51f
commit 30b04ab2d2
5 changed files with 47 additions and 12 deletions

View file

@ -58,6 +58,7 @@ dbapi.saveDevice = function(serial, device) {
, provider: device.provider
, owner: null
, status: device.status
, ready: false
, statusChangedAt: r.now()
, createdAt: r.now()
, lastHeartbeatAt: r.now()
@ -89,6 +90,7 @@ dbapi.unsetDeviceOwner = function(serial, owner) {
dbapi.setDeviceAbsent = function(serial) {
return db.run(r.table('devices').get(serial).update({
present: false
, ready: false
, lastHeartbeatAt: null
}))
}
@ -101,7 +103,8 @@ dbapi.setDeviceChannel = function(serial, channel) {
dbapi.saveDeviceIdentity = function(serial, identity) {
return db.run(r.table('devices').get(serial).update({
platform: identity.platform
ready: true
, platform: identity.platform
, manufacturer: identity.manufacturer
, operator: identity.operator
, model: identity.model