mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-17 23:53:25 +02:00
Allow group name change (#795)
* fix bug on email separator Signed-off-by: Denis barbaron <denis.barbaron@orange.com> * allow group name change Signed-off-by: Denis barbaron <denis.barbaron@orange.com> --------- Signed-off-by: Denis barbaron <denis.barbaron@orange.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright © 2019,2023 contains code contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
* Copyright © 2019-2024 contains code contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
**/
|
||||
|
||||
var r = require('rethinkdb')
|
||||
@@ -826,6 +826,31 @@ dbapi.updateDefaultUserGroupsQuotas = function(email, duration, number, repetiti
|
||||
}}}, {returnChanges: true}))
|
||||
}
|
||||
|
||||
dbapi.updateDeviceGroupName = function(serial, group) {
|
||||
return db.run(r.table('devices').get(serial).update({group: {
|
||||
name:
|
||||
r.branch(
|
||||
r.expr(apiutil.isOriginGroup(group.class)).eq(false)
|
||||
, r.branch(
|
||||
r.expr(group.isActive).eq(true)
|
||||
, group.name
|
||||
, r.row('group')('name')
|
||||
)
|
||||
, r.branch(
|
||||
r.row('group')('origin').eq(r.row('group')('id'))
|
||||
, group.name
|
||||
, r.row('group')('name')
|
||||
)
|
||||
)
|
||||
, originName:
|
||||
r.branch(
|
||||
r.expr(apiutil.isOriginGroup(group.class)).eq(true)
|
||||
, group.name
|
||||
, r.row('group')('originName')
|
||||
)
|
||||
}}))
|
||||
}
|
||||
|
||||
dbapi.updateDeviceCurrentGroupFromOrigin = function(serial) {
|
||||
return db.run(r.table('devices').get(serial)).then(function(device) {
|
||||
return db.run(r.table('groups').get(device.group.origin)).then(function(group) {
|
||||
|
||||
Reference in New Issue
Block a user