goldstars-services 1.0.29 → 1.0.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.
|
@@ -235,6 +235,31 @@ var getUserIfAdmin = /*#__PURE__*/function () {
|
|
|
235
235
|
return _ref7.apply(this, arguments);
|
|
236
236
|
};
|
|
237
237
|
}();
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* @description Soft delete user by ID
|
|
241
|
+
* @param {String} userId
|
|
242
|
+
* @returns Promise<UserModel>
|
|
243
|
+
*/
|
|
244
|
+
var softDeleteUser = /*#__PURE__*/function () {
|
|
245
|
+
var _ref8 = _asyncToGenerator(function* (userId) {
|
|
246
|
+
try {
|
|
247
|
+
var updatedUser = yield _user.default.findByIdAndUpdate(userId, {
|
|
248
|
+
isDeleted: true
|
|
249
|
+
}, {
|
|
250
|
+
new: true,
|
|
251
|
+
runValidators: true
|
|
252
|
+
});
|
|
253
|
+
return updatedUser;
|
|
254
|
+
} catch (error) {
|
|
255
|
+
console.error(error);
|
|
256
|
+
throw new Error('Error soft deleting user');
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
return function softDeleteUser(_x6) {
|
|
260
|
+
return _ref8.apply(this, arguments);
|
|
261
|
+
};
|
|
262
|
+
}();
|
|
238
263
|
var _default = exports.default = {
|
|
239
264
|
createUser,
|
|
240
265
|
getUser,
|
|
@@ -246,5 +271,6 @@ var _default = exports.default = {
|
|
|
246
271
|
getActiveTrainer,
|
|
247
272
|
unsubscribePacient,
|
|
248
273
|
getTrainersForClientsWithConfirmation,
|
|
249
|
-
getUserIfAdmin
|
|
274
|
+
getUserIfAdmin,
|
|
275
|
+
softDeleteUser
|
|
250
276
|
};
|