@dhyasama/totem-models 8.53.0 → 8.54.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/LimitedPartner.js +18 -0
- package/package.json +1 -1
package/lib/LimitedPartner.js
CHANGED
|
@@ -665,6 +665,24 @@ module.exports = function(mongoose, config) {
|
|
|
665
665
|
|
|
666
666
|
};
|
|
667
667
|
|
|
668
|
+
LimitedPartner.statics.removeCustomerDetails = function removeCustomerDetails(customerId, cb) {
|
|
669
|
+
|
|
670
|
+
const self = this;
|
|
671
|
+
|
|
672
|
+
if (!cb) { throw new Error('cb is required'); }
|
|
673
|
+
if (!customerId) { return cb(new Error('customerId is required'), null); }
|
|
674
|
+
if (!mongoose.Types.ObjectId.isValid(customerId)) { return cb(new Error('customerId is not a valid ObjectId'), null); }
|
|
675
|
+
|
|
676
|
+
let query = self.update(
|
|
677
|
+
{ 'customer': customerId },
|
|
678
|
+
{ $set: { details: [] } },
|
|
679
|
+
{ multi : true }
|
|
680
|
+
);
|
|
681
|
+
|
|
682
|
+
query.exec(cb);
|
|
683
|
+
|
|
684
|
+
};
|
|
685
|
+
|
|
668
686
|
LimitedPartner.statics.removeCustomerPeople = function removeCustomerPeople(customerId, cb) {
|
|
669
687
|
|
|
670
688
|
const self = this;
|