shuttlepro-shared 1.4.65 → 1.4.67

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.
@@ -15,7 +15,7 @@ const updateCachedMembers = async (workspaceId) => {
15
15
  .populate({
16
16
  path: "roleId",
17
17
  select:
18
- "id name userId userShift permissionId modulePermissions workspaceId",
18
+ "id name userId userShift permissionId modulePermissions workspaceId extraCapabilities scope",
19
19
  populate: [{ path: "permissionId", select: "id name" }],
20
20
  })
21
21
  .populate({
@@ -35,14 +35,14 @@ const updateCachedMembers = async (workspaceId) => {
35
35
 
36
36
  const getMembers = async (workspaceId) => {
37
37
  let members = await getRedisData(workspaceId, MEMBERS);
38
-
38
+
39
39
  if (!members || members?.length === 0) {
40
40
  members = await UserRole.find({ workspaceId })
41
41
  .select("userId role userShift roleId isOwner workspaceId")
42
42
  .populate({
43
43
  path: "roleId",
44
44
  select:
45
- "id name userId userShift permissionId modulePermissions workspaceId",
45
+ "id name userId userShift permissionId modulePermissions workspaceId extraCapabilities scope",
46
46
  populate: [{ path: "permissionId", select: "id name" }],
47
47
  })
48
48
  .populate({
@@ -165,6 +165,8 @@ const getUserRoleWithPermissions = async (workspaceId, userId) => {
165
165
  parentRole: data?.roleId?.permissionId?.name || "",
166
166
  parentRoleId: data?.roleId?.permissionId?._id?.toString() || "",
167
167
  defaultModule: data?.roleId?.defaultModule || "",
168
+ extraCapabilities: data?.roleId?.extraCapabilities || [],
169
+ scope: data?.roleId?.scope || "workspace",
168
170
  };
169
171
  return roleWithPermissions || null;
170
172
  }
@@ -197,7 +199,7 @@ const findUserWorkspaces = async (userId) => {
197
199
  .select("userId roleId workspaceId")
198
200
  .populate({
199
201
  path: "roleId",
200
- select: "id name userId userShift permissionId modulePermissions",
202
+ select: "id name userId userShift permissionId modulePermissions extraCapabilities scope",
201
203
  populate: [{ path: "permissionId", select: "id name" }],
202
204
  })
203
205
  .populate({
@@ -217,6 +219,8 @@ const findUserWorkspaces = async (userId) => {
217
219
  _id: ur?.workspaceId?._id?.toString(),
218
220
  role: ur?.roleId?.name || "",
219
221
  permissions: ur?.roleId?.modulePermissions?.modules || [],
222
+ extraCapabilities: ur?.roleId?.extraCapabilities || [],
223
+ scope: ur?.roleId?.scope || "workspace",
220
224
  };
221
225
  });
222
226
  return userRoleWithWorkspaces || [];
@@ -11,7 +11,8 @@ const userRoleSchema = new Schema(
11
11
  workspaceId: {
12
12
  type: mongoose.Schema.Types.ObjectId,
13
13
  ref: "Workspace",
14
- required: true,
14
+ required: false, // Optional for global roles
15
+ default: null,
15
16
  },
16
17
  role: {
17
18
  type: String,
@@ -0,0 +1,14 @@
1
+ const mongoose = require("mongoose");
2
+ const { Schema } = mongoose;
3
+
4
+ const WebhookSchema = new Schema(
5
+ {
6
+ isDeleted: { type: Boolean, default: false },
7
+ data: { type: Object, default: null },
8
+ },
9
+ { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
10
+ );
11
+
12
+ const Webhook = mongoose.model("Webhook", WebhookSchema);
13
+
14
+ module.exports = Webhook;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shuttlepro-shared",
3
- "version": "1.4.65",
3
+ "version": "1.4.67",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {