Fix incorrect fetch of userVars when userId is not specified
This commit is contained in:
@ -32,11 +32,15 @@ export class UserVarsService<
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const userVarUserLevel = await this.keyValuePairService.get({
|
let userVarUserLevel: any[] = [];
|
||||||
type: KeyValuePairType.USER_VAR,
|
|
||||||
userId,
|
if (userId) {
|
||||||
key,
|
userVarUserLevel = await this.keyValuePairService.get({
|
||||||
});
|
type: KeyValuePairType.USER_VAR,
|
||||||
|
userId,
|
||||||
|
key,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (userVarUserLevel.length > 1) {
|
if (userVarUserLevel.length > 1) {
|
||||||
throw new Error(`Multiple values found for key ${key} at user level`);
|
throw new Error(`Multiple values found for key ${key} at user level`);
|
||||||
@ -60,10 +64,14 @@ export class UserVarsService<
|
|||||||
workspaceId,
|
workspaceId,
|
||||||
});
|
});
|
||||||
|
|
||||||
const userVarsUserLevel = await this.keyValuePairService.get({
|
let userVarsUserLevel: any[] = [];
|
||||||
type: KeyValuePairType.USER_VAR,
|
|
||||||
userId,
|
if (userId) {
|
||||||
});
|
userVarsUserLevel = await this.keyValuePairService.get({
|
||||||
|
type: KeyValuePairType.USER_VAR,
|
||||||
|
userId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return mergeUserVars<Extract<keyof KeyValueTypesMap, string>>([
|
return mergeUserVars<Extract<keyof KeyValueTypesMap, string>>([
|
||||||
...userVarsWorkspaceLevel,
|
...userVarsWorkspaceLevel,
|
||||||
|
|||||||
Reference in New Issue
Block a user