@dhyasama/totem-models 8.54.0 → 8.55.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.
@@ -665,7 +665,7 @@ module.exports = function(mongoose, config) {
665
665
 
666
666
  };
667
667
 
668
- LimitedPartner.statics.removeCustomerDetails = function removeCustomerDetails(customerId, cb) {
668
+ LimitedPartner.statics.removeCustomerExtras = function removeCustomerExtras(customerId, cb) {
669
669
 
670
670
  const self = this;
671
671
 
@@ -675,25 +675,7 @@ module.exports = function(mongoose, config) {
675
675
 
676
676
  let query = self.update(
677
677
  { 'customer': customerId },
678
- { $set: { details: [] } },
679
- { multi : true }
680
- );
681
-
682
- query.exec(cb);
683
-
684
- };
685
-
686
- LimitedPartner.statics.removeCustomerPeople = function removeCustomerPeople(customerId, cb) {
687
-
688
- const self = this;
689
-
690
- if (!cb) { throw new Error('cb is required'); }
691
- if (!customerId) { return cb(new Error('customerId is required'), null); }
692
- if (!mongoose.Types.ObjectId.isValid(customerId)) { return cb(new Error('customerId is not a valid ObjectId'), null); }
693
-
694
- let query = self.update(
695
- { 'customer': customerId },
696
- { $set: { people: [] } },
678
+ { $set: { details: [], people: [], contact: { phone: [], email: [], address: [] } } },
697
679
  { multi : true }
698
680
  );
699
681
 
@@ -757,13 +739,13 @@ module.exports = function(mongoose, config) {
757
739
 
758
740
  LimitedPartner.plugin(filter, {
759
741
  'readFilter': {
760
- 'admin': ['name', 'shortName', 'customer', 'start', 'people', 'documentSlugs', 'transactions', 'contact', 'entered', 'status', 'flagged', 'flags', 'notes'],
761
- 'lp-full': ['name', 'shortName', 'customer', 'start', 'people', 'documentSlugs', 'transactions', 'contact', 'entered', 'status', 'flagged', 'flags', 'notes'],
742
+ 'admin': ['name', 'shortName', 'customer', 'start', 'people', 'documentSlugs', 'transactions', 'contact', 'entered', 'status', 'flagged', 'flags', 'notes, details'],
743
+ 'lp-full': ['name', 'shortName', 'customer', 'start', 'people', 'documentSlugs', 'transactions', 'contact', 'entered', 'status', 'flagged', 'flags', 'notes, details'],
762
744
  'none': []
763
745
  },
764
746
  'writeFilter': {
765
- 'admin': ['name', 'shortName', 'customer', 'start', 'people', 'documentSlugs', 'transactions', 'contact', 'entered', 'status', 'flagged', 'flags', 'notes'],
766
- 'lp-full': ['name', 'shortName', 'customer', 'start', 'people', 'documentSlugs', 'transactions', 'contact', 'entered', 'status', 'flagged', 'flags', 'notes'],
747
+ 'admin': ['name', 'shortName', 'customer', 'start', 'people', 'documentSlugs', 'transactions', 'contact', 'entered', 'status', 'flagged', 'flags', 'notes', 'details'],
748
+ 'lp-full': ['name', 'shortName', 'customer', 'start', 'people', 'documentSlugs', 'transactions', 'contact', 'entered', 'status', 'flagged', 'flags', 'notes', 'details'],
767
749
  'none': []
768
750
  },
769
751
  'defaultFilterRole': 'none',
package/lib/Person.js CHANGED
@@ -137,7 +137,10 @@ module.exports = function(mongoose, config) {
137
137
  /////////////
138
138
 
139
139
  Person.virtual('name.full').get(function () {
140
- return this.name.first + ' ' + this.name.last;
140
+ var name = '';
141
+ if(this.name.first) name += this.name.first
142
+ if(this.name.last) name += this.name.last;
143
+ return name;
141
144
  });
142
145
 
143
146
  Person.virtual('avatar').get(function() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "8.54.0",
3
+ "version": "8.55.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",