shuttlepro-shared 1.2.29 → 1.2.31

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 =
@@ -120,12 +120,21 @@ const deleteUserRole = async (id) => {
120
120
 
121
121
  const findUserWorkspaces = async (userId) => {
122
122
  const cacheKey = `${CACHE_KEY_USER_WORKSPACE_PREFIX}${userId}`;
123
+ console.log(cacheKey, "cacheKey");
123
124
  let userRoleWithWorkspaces = await getRedisData(cacheKey);
124
125
 
126
+ console.log(userRoleWithWorkspaces, "userRoleWithWorkspaces");
127
+
125
128
  if (!userRoleWithWorkspaces) {
126
129
  userRoleWithWorkspaces = await UserRole.find({
127
130
  userId: userId,
128
131
  })
132
+ .select("userId roleId workspaceId")
133
+ .populate({
134
+ path: "roleId",
135
+ select: "id name userId userShift permissionId modulePermissions",
136
+ populate: [{ path: "permissionId", select: "id name" }],
137
+ })
129
138
  .populate({
130
139
  path: "workspaceId",
131
140
  select: defaultSelect,
@@ -133,7 +142,7 @@ const findUserWorkspaces = async (userId) => {
133
142
  })
134
143
  .lean()
135
144
  .exec();
136
-
145
+ console.log(userRoleWithWorkspaces, "userRoleWithWorkspaces");
137
146
  if (userRoleWithWorkspaces) {
138
147
  await addDataToRedisSet(cacheKey, userRoleWithWorkspaces);
139
148
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shuttlepro-shared",
3
- "version": "1.2.29",
3
+ "version": "1.2.31",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {