mirror of
https://github.com/openstf/stf
synced 2025-10-04 10:19:30 +02:00
Save user settings to the database and embed them to the template for fast access.
This commit is contained in:
parent
332c7b6106
commit
e13fc6701f
11 changed files with 152 additions and 141 deletions
|
@ -25,6 +25,7 @@ dbapi.saveUserAfterLogin = function(user) {
|
|||
, lastLoggedInAt: r.now()
|
||||
, createdAt: r.now()
|
||||
, forwards: []
|
||||
, settings: {}
|
||||
}))
|
||||
}
|
||||
return stats
|
||||
|
@ -35,6 +36,18 @@ dbapi.loadUser = function(email) {
|
|||
return db.run(r.table('users').get(email))
|
||||
}
|
||||
|
||||
dbapi.updateUserSettings = function(email, changes) {
|
||||
return db.run(r.table('users').get(email).update({
|
||||
settings: changes
|
||||
}))
|
||||
}
|
||||
|
||||
dbapi.resetUserSettings = function(email) {
|
||||
return db.run(r.table('users').get(email).update({
|
||||
settings: r.literal({})
|
||||
}))
|
||||
}
|
||||
|
||||
dbapi.addUserForward = function(email, forward) {
|
||||
var devicePort = forward.devicePort
|
||||
return db.run(r.table('users').get(email).update({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue