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

Add owners to groups.

This commit is contained in:
Simo Kinnunen 2014-02-04 20:33:53 +09:00
parent 3e7d91cb91
commit 37303c5d92
8 changed files with 98 additions and 70 deletions

View file

@ -46,6 +46,7 @@ dbapi.saveDevice = function(serial, device) {
serial: serial
, present: true
, provider: device.provider
, owner: null
, status: device.status
, statusChangedAt: r.now()
, createdAt: r.now()
@ -65,6 +66,18 @@ dbapi.saveDeviceStatus = function(serial, status) {
})
}
dbapi.setDeviceOwner = function(serial, owner) {
return db.run(r.table('devices').get(serial).update({
owner: owner
}))
}
dbapi.unsetDeviceOwner = function(serial, owner) {
return db.run(r.table('devices').get(serial).update({
owner: null
}))
}
dbapi.setDeviceAbsent = function(serial) {
return db.run(r.table('devices').get(serial).update({
present: false