shuttlepro-shared 1.2.87 → 1.2.89
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.
|
@@ -188,24 +188,15 @@ const updateRoleById = async (id, updateData) => {
|
|
|
188
188
|
}),
|
|
189
189
|
};
|
|
190
190
|
delete updateQuery.logs;
|
|
191
|
-
|
|
192
191
|
const updatedRole = await Role.findByIdAndUpdate(id, updateQuery, {
|
|
193
192
|
new: true,
|
|
194
193
|
})
|
|
195
194
|
.populate("permissionId")
|
|
196
195
|
.lean()
|
|
197
196
|
.exec();
|
|
198
|
-
|
|
199
197
|
if (updatedRole) {
|
|
200
|
-
|
|
201
|
-
await updateCachedRoles(updatedRole.workspaceId);
|
|
202
|
-
}
|
|
203
|
-
// Update default roles cache if needed
|
|
204
|
-
if (!updatedRole.workspaceId) {
|
|
205
|
-
await updateCachedDefaultRoles();
|
|
206
|
-
}
|
|
198
|
+
await updateCachedRoles(updatedRole?.workspaceId);
|
|
207
199
|
}
|
|
208
|
-
|
|
209
200
|
return updatedRole;
|
|
210
201
|
};
|
|
211
202
|
|
|
@@ -216,17 +207,9 @@ const updateRoleByFilter = async (filter, updateData) => {
|
|
|
216
207
|
.populate("permissionId")
|
|
217
208
|
.lean()
|
|
218
209
|
.exec();
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
if (updatedRole.workspaceId) {
|
|
222
|
-
await updateCachedRoles(updatedRole.workspaceId);
|
|
223
|
-
}
|
|
224
|
-
// Update default roles cache if needed
|
|
225
|
-
if (!updatedRole.workspaceId) {
|
|
226
|
-
await updateCachedDefaultRoles();
|
|
227
|
-
}
|
|
210
|
+
if (updatedRole?.workspaceId) {
|
|
211
|
+
await updateCachedRoles(updatedRole?.workspaceId?.toString());
|
|
228
212
|
}
|
|
229
|
-
|
|
230
213
|
return updatedRole;
|
|
231
214
|
};
|
|
232
215
|
|