@dhyasama/totem-models 1.17.3 → 1.17.5
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 +1 -1
- package/lib/Activity.js +1 -1
- package/lib/CalendarEvent.js +1 -1
- package/lib/CapTable.js +1 -1
- package/lib/Document.js +1 -1
- package/lib/Fund.js +1 -1
- package/lib/Investment.js +1 -1
- package/lib/LimitedPartner.js +1 -1
- package/lib/List.js +1 -1
- package/lib/News.js +1 -1
- package/lib/Note.js +1 -1
- package/lib/Organization.js +23 -2
- package/lib/Person.js +1 -1
- package/lib/Round.js +1 -1
- package/package.json +1 -1
package/lib/Account.js
CHANGED
|
@@ -256,7 +256,7 @@ module.exports = function(mongoose, config) {
|
|
|
256
256
|
// Person.account
|
|
257
257
|
});
|
|
258
258
|
|
|
259
|
-
Account.set('autoIndex',
|
|
259
|
+
Account.set('autoIndex', false);
|
|
260
260
|
Account.on('index', function(err) { console.log('error building account indexes: ' + err); });
|
|
261
261
|
|
|
262
262
|
var deepPopulate = require('mongoose-deep-populate')(mongoose);
|
package/lib/Activity.js
CHANGED
|
@@ -130,7 +130,7 @@ module.exports = function(mongoose, config) {
|
|
|
130
130
|
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
-
Activity.set('autoIndex',
|
|
133
|
+
Activity.set('autoIndex', false);
|
|
134
134
|
Activity.on('index', function(err) { console.log('error building activity indexes: ' + err); });
|
|
135
135
|
|
|
136
136
|
mongoose.model('Activity', Activity);
|
package/lib/CalendarEvent.js
CHANGED
|
@@ -142,7 +142,7 @@ module.exports = function(mongoose, config) {
|
|
|
142
142
|
// Person.calendarEventId
|
|
143
143
|
});
|
|
144
144
|
|
|
145
|
-
CalendarEvent.set('autoIndex',
|
|
145
|
+
CalendarEvent.set('autoIndex', false);
|
|
146
146
|
CalendarEvent.on('index', function(err) { console.log('error building calendar event indexes: ' + err); });
|
|
147
147
|
|
|
148
148
|
mongoose.model('CalendarEvent', CalendarEvent);
|
package/lib/CapTable.js
CHANGED
|
@@ -407,7 +407,7 @@ module.exports = function(mongoose, config) {
|
|
|
407
407
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
408
408
|
|
|
409
409
|
CapTable.set('toJSON', { virtuals: true });
|
|
410
|
-
CapTable.set('autoIndex',
|
|
410
|
+
CapTable.set('autoIndex', false);
|
|
411
411
|
|
|
412
412
|
CapTable.index({ organization: 1, customer: 1 }, { unique: true, partialFilterExpression : { type :"string" } });
|
|
413
413
|
CapTable.on('index', function(err) { console.log('error building CapTable indexes: ' + err); });
|
package/lib/Document.js
CHANGED
|
@@ -349,7 +349,7 @@ module.exports = function(mongoose, config) {
|
|
|
349
349
|
});
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
-
Document.set('autoIndex',
|
|
352
|
+
Document.set('autoIndex', false);
|
|
353
353
|
Document.on('index', function(err) { console.log('error building document indexes: ' + err); });
|
|
354
354
|
|
|
355
355
|
mongoose.model('Document', Document);
|
package/lib/Fund.js
CHANGED
|
@@ -179,7 +179,7 @@ module.exports = function(mongoose, config) {
|
|
|
179
179
|
// PortfolioCompany.fundsInvested
|
|
180
180
|
});
|
|
181
181
|
|
|
182
|
-
Fund.set('autoIndex',
|
|
182
|
+
Fund.set('autoIndex', false);
|
|
183
183
|
Fund.on('index', function(err) { console.log('error building fund indexes: ' + err); });
|
|
184
184
|
|
|
185
185
|
mongoose.model('Fund', Fund);
|
package/lib/Investment.js
CHANGED
|
@@ -166,7 +166,7 @@ module.exports = function(mongoose, config) {
|
|
|
166
166
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
167
167
|
|
|
168
168
|
Investment.set('toJSON', { virtuals: true });
|
|
169
|
-
Investment.set('autoIndex',
|
|
169
|
+
Investment.set('autoIndex', false);
|
|
170
170
|
|
|
171
171
|
Investment.on('index', function(err) { console.log('error building Investment indexes: ' + err); });
|
|
172
172
|
|
package/lib/LimitedPartner.js
CHANGED
|
@@ -730,7 +730,7 @@ module.exports = function(mongoose, config) {
|
|
|
730
730
|
|
|
731
731
|
//////////////////////////////
|
|
732
732
|
|
|
733
|
-
LimitedPartner.set('autoIndex',
|
|
733
|
+
LimitedPartner.set('autoIndex', false);
|
|
734
734
|
LimitedPartner.on('index', function(err) { console.log('error building limited partner indexes: ' + err); });
|
|
735
735
|
|
|
736
736
|
LimitedPartner.set('toJSON', { virtuals: true });
|
package/lib/List.js
CHANGED
|
@@ -208,7 +208,7 @@ module.exports = function(mongoose, config) {
|
|
|
208
208
|
|
|
209
209
|
});
|
|
210
210
|
|
|
211
|
-
List.set('autoIndex',
|
|
211
|
+
List.set('autoIndex', false);
|
|
212
212
|
List.on('index', function(err) { console.log('error building list indexes: ' + err); });
|
|
213
213
|
|
|
214
214
|
mongoose.model('List', List);
|
package/lib/News.js
CHANGED
|
@@ -100,7 +100,7 @@ module.exports = function(mongoose, config) {
|
|
|
100
100
|
});
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
News.set('autoIndex',
|
|
103
|
+
News.set('autoIndex', false);
|
|
104
104
|
News.on('index', function(err) { console.log('error building news indexes: ' + err); });
|
|
105
105
|
|
|
106
106
|
mongoose.model('News', News);
|
package/lib/Note.js
CHANGED
|
@@ -162,7 +162,7 @@ module.exports = function(mongoose, config) {
|
|
|
162
162
|
|
|
163
163
|
});
|
|
164
164
|
|
|
165
|
-
Note.set('autoIndex',
|
|
165
|
+
Note.set('autoIndex', false);
|
|
166
166
|
Note.on('index', function(err) { console.log('error building note indexes: ' + err); });
|
|
167
167
|
|
|
168
168
|
mongoose.model('Note', Note);
|
package/lib/Organization.js
CHANGED
|
@@ -10,6 +10,7 @@ module.exports = function(mongoose, config) {
|
|
|
10
10
|
Schema = mongoose.Schema,
|
|
11
11
|
Note = mongoose.model('Note'),
|
|
12
12
|
|
|
13
|
+
customerFunds = [],
|
|
13
14
|
customerPortfolio = [],
|
|
14
15
|
|
|
15
16
|
Organization = new Schema({
|
|
@@ -733,7 +734,7 @@ module.exports = function(mongoose, config) {
|
|
|
733
734
|
Organization.statics.getById = function getById(id, cb) {
|
|
734
735
|
|
|
735
736
|
var self = this;
|
|
736
|
-
|
|
737
|
+
console.log(self.customerFunds)
|
|
737
738
|
self
|
|
738
739
|
.findById(id)
|
|
739
740
|
.populate('people.person', 'name avatarUrl title calendarEventSummaries sources')
|
|
@@ -1026,6 +1027,12 @@ module.exports = function(mongoose, config) {
|
|
|
1026
1027
|
|
|
1027
1028
|
};
|
|
1028
1029
|
|
|
1030
|
+
Organization.statics.setCustomerFunds = function setCustomerFunds(fundids) {
|
|
1031
|
+
var self = this;
|
|
1032
|
+
self.customerFunds = fundids;
|
|
1033
|
+
return self.customerFunds;
|
|
1034
|
+
};
|
|
1035
|
+
|
|
1029
1036
|
Organization.statics.setCustomerPortfolio = function setCustomerPortfolio(portfolio) {
|
|
1030
1037
|
var self = this;
|
|
1031
1038
|
self.customerPortfolio = portfolio;
|
|
@@ -1105,6 +1112,20 @@ module.exports = function(mongoose, config) {
|
|
|
1105
1112
|
|
|
1106
1113
|
});
|
|
1107
1114
|
|
|
1115
|
+
// var customerFunds = doc.constructor.customerFunds;
|
|
1116
|
+
// //console.log('customerFunds', customerFunds);
|
|
1117
|
+
// doc.lps = _.filter(doc.lps, function(lp) {
|
|
1118
|
+
// var lpFunds = _.pluck(lp.fundsInvested, 'fund');
|
|
1119
|
+
// var intersection = _.intersection(lpFunds, customerFunds);
|
|
1120
|
+
// return intersection.length >= 1;
|
|
1121
|
+
// });
|
|
1122
|
+
|
|
1123
|
+
// will there ever be a reason to show an org's lps?
|
|
1124
|
+
// a customer should only be able to see their own lps, which are queried and viewable on /lps
|
|
1125
|
+
// and if it's not used, why is it here?
|
|
1126
|
+
// todo - research flipping ref onto lp model
|
|
1127
|
+
doc.lps = [];
|
|
1128
|
+
|
|
1108
1129
|
return next();
|
|
1109
1130
|
|
|
1110
1131
|
});
|
|
@@ -1116,7 +1137,7 @@ module.exports = function(mongoose, config) {
|
|
|
1116
1137
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
1117
1138
|
|
|
1118
1139
|
Organization.set('toJSON', { virtuals: true });
|
|
1119
|
-
Organization.set('autoIndex',
|
|
1140
|
+
Organization.set('autoIndex', false);
|
|
1120
1141
|
|
|
1121
1142
|
Organization.index({ website: 1, websiteAliases: 1 }, { unique: true, partialFilterExpression : { type :"string" } });
|
|
1122
1143
|
Organization.on('index', function(err) { console.log('error building organization_new indexes: ' + err); });
|
package/lib/Person.js
CHANGED
|
@@ -1114,7 +1114,7 @@ module.exports = function(mongoose, config) {
|
|
|
1114
1114
|
var deepPopulate = require('mongoose-deep-populate')(mongoose);
|
|
1115
1115
|
Person.plugin(deepPopulate);
|
|
1116
1116
|
|
|
1117
|
-
Person.set('autoIndex',
|
|
1117
|
+
Person.set('autoIndex', false);
|
|
1118
1118
|
Person.on('index', function(err) { console.log('error building person indexes: ' + err); });
|
|
1119
1119
|
|
|
1120
1120
|
Person.set('toJSON', { virtuals: true });
|
package/lib/Round.js
CHANGED
|
@@ -833,7 +833,7 @@ module.exports = function(mongoose, config) {
|
|
|
833
833
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
834
834
|
|
|
835
835
|
Round.set('toJSON', { virtuals: true });
|
|
836
|
-
Round.set('autoIndex',
|
|
836
|
+
Round.set('autoIndex', false);
|
|
837
837
|
|
|
838
838
|
Round.index({ organization: 1, roundName: 1 }, { unique: true, partialFilterExpression : { type :"string" } });
|
|
839
839
|
Round.on('index', function(err) { console.log('error building Round indexes: ' + err); });
|