shuttlepro-shared 1.2.28 → 1.2.30
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const UserRole = require("../../models/UserRole");
|
|
1
|
+
const { UserRole } = require("../../models/UserRole");
|
|
2
2
|
const { getRedisData, addDataToRedisSet } = require("../../config/redis");
|
|
3
3
|
|
|
4
4
|
const defaultSelect =
|
|
@@ -118,12 +118,12 @@ const deleteUserRole = async (id) => {
|
|
|
118
118
|
return deletedRole;
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
-
const
|
|
121
|
+
const findUserWorkspaces = async (userId) => {
|
|
122
122
|
const cacheKey = `${CACHE_KEY_USER_WORKSPACE_PREFIX}${userId}`;
|
|
123
123
|
let userRoleWithWorkspaces = await getRedisData(cacheKey);
|
|
124
124
|
|
|
125
125
|
if (!userRoleWithWorkspaces) {
|
|
126
|
-
userRoleWithWorkspaces = await UserRole.
|
|
126
|
+
userRoleWithWorkspaces = await UserRole.find({
|
|
127
127
|
userId: userId,
|
|
128
128
|
})
|
|
129
129
|
.populate({
|
|
@@ -147,5 +147,5 @@ module.exports = {
|
|
|
147
147
|
findUserRole,
|
|
148
148
|
updateUserRole,
|
|
149
149
|
deleteUserRole,
|
|
150
|
-
|
|
150
|
+
findUserWorkspaces,
|
|
151
151
|
};
|