diff options
author | =Corey Hulen <corey@hulen.com> | 2016-01-26 20:32:24 -0500 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2016-01-26 20:32:24 -0500 |
commit | c2bc9454ce5550a180d8ee9fec75db7f3841b1ad (patch) | |
tree | bb56d39a6eb468dc002486723bdb085ca7b20a3b /store/sql_session_store.go | |
parent | 21d51f8c9094f434afed8d23d4790aea28a4c0df (diff) | |
download | chat-c2bc9454ce5550a180d8ee9fec75db7f3841b1ad.tar.gz chat-c2bc9454ce5550a180d8ee9fec75db7f3841b1ad.tar.bz2 chat-c2bc9454ce5550a180d8ee9fec75db7f3841b1ad.zip |
PLT-1586 adding attach device id method
Diffstat (limited to 'store/sql_session_store.go')
-rw-r--r-- | store/sql_session_store.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/store/sql_session_store.go b/store/sql_session_store.go index 4762a1dfd..6532947f4 100644 --- a/store/sql_session_store.go +++ b/store/sql_session_store.go @@ -232,3 +232,21 @@ func (me SqlSessionStore) UpdateRoles(userId, roles string) StoreChannel { return storeChannel } + +func (me SqlSessionStore) UpdateDeviceId(id, deviceId string) StoreChannel { + storeChannel := make(StoreChannel) + + go func() { + result := StoreResult{} + if _, err := me.GetMaster().Exec("UPDATE Sessions SET DeviceId = :DeviceId WHERE Id = :Id", map[string]interface{}{"DeviceId": deviceId, "Id": id}); err != nil { + result.Err = model.NewLocAppError("SqlSessionStore.UpdateDeviceId", "store.sql_session.update_device_id.app_error", nil, "") + } else { + result.Data = deviceId + } + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} |