@dhyasama/totem-models 10.12.0 → 10.13.0
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.
- package/lib/Account.js +12 -0
- package/package.json +1 -1
package/lib/Account.js
CHANGED
|
@@ -324,6 +324,18 @@ module.exports = function(mongoose, config) {
|
|
|
324
324
|
|
|
325
325
|
};
|
|
326
326
|
|
|
327
|
+
Account.statics.delete = function (id, options, cb) {
|
|
328
|
+
|
|
329
|
+
const self = this;
|
|
330
|
+
|
|
331
|
+
if (!cb) { throw new Error('cb is required'); }
|
|
332
|
+
if (!id) { return cb(new Error('id is required'), null); }
|
|
333
|
+
if (!mongoose.Types.ObjectId.isValid(id)) { return cb(new Error('id is not a valid ObjectId'), null); }
|
|
334
|
+
|
|
335
|
+
self.findByIdAndRemove(id, cb);
|
|
336
|
+
|
|
337
|
+
};
|
|
338
|
+
|
|
327
339
|
Account.statics.upsert = function(account, cb) {
|
|
328
340
|
|
|
329
341
|
// No population so no need to scrub
|