@dhyasama/totem-models 3.0.0 → 3.2.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.
@@ -143,6 +143,9 @@ module.exports = function(mongoose, config) {
143
143
  // customer specific (customer id is stored on note)
144
144
  notes: [ { type: Schema.ObjectId, ref: 'Note' } ],
145
145
 
146
+ // customer specific (customer id is stored on doc)
147
+ documents: [ { type: Schema.ObjectId, ref: 'Document' } ],
148
+
146
149
  customer: {
147
150
 
148
151
  active: { type: Boolean, default: false },
@@ -176,11 +179,6 @@ module.exports = function(mongoose, config) {
176
179
 
177
180
  },
178
181
 
179
- docs: [{
180
- customer: { type: Schema.ObjectId, ref: 'Organization' },
181
- url: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } }
182
- }],
183
-
184
182
  // Link to deeper data on iLevel
185
183
  // iLevelUser must be true at the account level
186
184
  iLevel: [{
@@ -823,7 +821,16 @@ module.exports = function(mongoose, config) {
823
821
  query.populate('operating.acquired.public.by', 'name logoUrl');
824
822
  query.populate('operating.acquired.private.by', 'name logoUrl');
825
823
 
826
- if (options.role != 'none') query.populate(lpPopulateOptions);
824
+ if (options.role != 'none') {
825
+ query.populate(lpPopulateOptions);
826
+ query.deepPopulate([
827
+ 'lps.fundsInvested.fund'
828
+ ], {
829
+ populate: {
830
+ 'lps.fundsInvested.fund': { select: 'shortName' }
831
+ }
832
+ })
833
+ }
827
834
 
828
835
  query.exec(cb);
829
836
 
@@ -1354,7 +1361,6 @@ module.exports = function(mongoose, config) {
1354
1361
 
1355
1362
  doc.lps = _.reject(doc.lps, function(item) { return !item.customer || item.customer.toString() != CUSTOMER_ID; });
1356
1363
  doc.filters = _.reject(doc.filters, function(item) { return !item.customer || item.customer.toString() != CUSTOMER_ID; });
1357
- doc.docs = _.reject(doc.docs, function(item) { return !item.customer || item.customer.toString() != CUSTOMER_ID; });
1358
1364
  doc.iLevel = _.reject(doc.iLevel, function(item) { return !item.customer || item.customer.toString() != CUSTOMER_ID; });
1359
1365
  doc.chairs = _.reject(doc.chairs, function(item) { return !item.customer || item.customer.toString() != CUSTOMER_ID; });
1360
1366
  doc.operating.acquired.private = _.find(doc.operating.acquired.private, function(item) { return !item.customer || item.customer.toString() == CUSTOMER_ID; });
package/lib/Person.js CHANGED
@@ -94,6 +94,8 @@ module.exports = function(mongoose, config) {
94
94
 
95
95
  notes: [ { type: Schema.ObjectId, ref: 'Note' } ],
96
96
 
97
+ documents: [ { type: Schema.ObjectId, ref: 'Document' } ],
98
+
97
99
  // this only relates to access for lps
98
100
  syndication: {
99
101
  notify: { type: Boolean, default: false }