shuttlepro-shared 1.2.33 → 1.2.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -123,12 +123,8 @@ const deleteUserRole = async (id) => {
|
|
|
123
123
|
|
|
124
124
|
const findUserWorkspaces = async (userId) => {
|
|
125
125
|
const cacheKey = `${CACHE_KEY_USER_WORKSPACE_PREFIX}${userId}`;
|
|
126
|
-
console.log(cacheKey, "cacheKey");
|
|
127
126
|
let userRoleWithWorkspaces = await getDataFromRedisSet(cacheKey);
|
|
128
|
-
|
|
129
|
-
console.log(userRoleWithWorkspaces, "userRoleWithWorkspaces");
|
|
130
|
-
|
|
131
|
-
if (!userRoleWithWorkspaces) {
|
|
127
|
+
if (!userRoleWithWorkspaces.length) {
|
|
132
128
|
userRoleWithWorkspaces = await UserRole.find({
|
|
133
129
|
userId: userId,
|
|
134
130
|
})
|
|
@@ -150,7 +146,6 @@ const findUserWorkspaces = async (userId) => {
|
|
|
150
146
|
await addDataToRedisSet(cacheKey, userRoleWithWorkspaces);
|
|
151
147
|
}
|
|
152
148
|
}
|
|
153
|
-
|
|
154
149
|
return userRoleWithWorkspaces;
|
|
155
150
|
};
|
|
156
151
|
|
package/config/redis.js
CHANGED
|
@@ -107,6 +107,7 @@ const getDataFromRedisSet = async (key) => {
|
|
|
107
107
|
try {
|
|
108
108
|
await connectRedis();
|
|
109
109
|
const values = await client.sMembers(key);
|
|
110
|
+
console.log(values, "values");
|
|
110
111
|
return values; // returns an array of values
|
|
111
112
|
} catch (err) {
|
|
112
113
|
console.error("Redis Error:", err);
|