@dhyasama/totem-models 8.53.0 → 8.54.1

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.
@@ -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;
@@ -739,13 +757,13 @@ module.exports = function(mongoose, config) {
739
757
 
740
758
  LimitedPartner.plugin(filter, {
741
759
  'readFilter': {
742
- 'admin': ['name', 'shortName', 'customer', 'start', 'people', 'documentSlugs', 'transactions', 'contact', 'entered', 'status', 'flagged', 'flags', 'notes'],
743
- 'lp-full': ['name', 'shortName', 'customer', 'start', 'people', 'documentSlugs', 'transactions', 'contact', 'entered', 'status', 'flagged', 'flags', 'notes'],
760
+ 'admin': ['name', 'shortName', 'customer', 'start', 'people', 'documentSlugs', 'transactions', 'contact', 'entered', 'status', 'flagged', 'flags', 'notes, details'],
761
+ 'lp-full': ['name', 'shortName', 'customer', 'start', 'people', 'documentSlugs', 'transactions', 'contact', 'entered', 'status', 'flagged', 'flags', 'notes, details'],
744
762
  'none': []
745
763
  },
746
764
  'writeFilter': {
747
- 'admin': ['name', 'shortName', 'customer', 'start', 'people', 'documentSlugs', 'transactions', 'contact', 'entered', 'status', 'flagged', 'flags', 'notes'],
748
- 'lp-full': ['name', 'shortName', 'customer', 'start', 'people', 'documentSlugs', 'transactions', 'contact', 'entered', 'status', 'flagged', 'flags', 'notes'],
765
+ 'admin': ['name', 'shortName', 'customer', 'start', 'people', 'documentSlugs', 'transactions', 'contact', 'entered', 'status', 'flagged', 'flags', 'notes', 'details'],
766
+ 'lp-full': ['name', 'shortName', 'customer', 'start', 'people', 'documentSlugs', 'transactions', 'contact', 'entered', 'status', 'flagged', 'flags', 'notes', 'details'],
749
767
  'none': []
750
768
  },
751
769
  'defaultFilterRole': 'none',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "8.53.0",
3
+ "version": "8.54.1",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",