fix(security.gblib): Params support in users.
This commit is contained in:
parent
dc0fdc0564
commit
82a9ba983e
3 changed files with 11 additions and 3 deletions
5
.hintrc
Normal file
5
.hintrc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"extends": [
|
||||||
|
"development"
|
||||||
|
]
|
||||||
|
}
|
|
@ -271,10 +271,14 @@ export class SecService extends GBService {
|
||||||
*/
|
*/
|
||||||
public async setParam (userId: number, name: string, value:any) {
|
public async setParam (userId: number, name: string, value:any) {
|
||||||
const options = { where: {} };
|
const options = { where: {} };
|
||||||
options.where = { botId: userId };
|
options.where = { userId: userId };
|
||||||
let user = await GuaribasUser.findOne(options);
|
let user = await GuaribasUser.findOne(options);
|
||||||
// tslint:disable-next-line:prefer-object-spread
|
// tslint:disable-next-line:prefer-object-spread
|
||||||
let obj = JSON.parse(user.params);
|
let obj = JSON.parse(user.params);
|
||||||
|
if (!obj)
|
||||||
|
{
|
||||||
|
obj = {};
|
||||||
|
}
|
||||||
obj['name'] = value;
|
obj['name'] = value;
|
||||||
user.params = JSON.stringify(obj);
|
user.params = JSON.stringify(obj);
|
||||||
return await user.save();
|
return await user.save();
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
{
|
{
|
||||||
"compilerOptions
|
"compilerOptions": {
|
||||||
": {
|
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"downlevelIteration": true,
|
"downlevelIteration": true,
|
||||||
"baseUrl": "./",
|
"baseUrl": "./",
|
||||||
|
|
Loading…
Add table
Reference in a new issue