@dhyasama/totem-models 7.40.1 → 7.42.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 +6 -6
- package/lib/List.js +1 -1
- package/lib/Organization.js +5 -5
- package/lib/Person.js +9 -9
- package/lib/Round.js +3 -5
- package/package.json +1 -1
package/lib/LimitedPartner.js
CHANGED
|
@@ -345,7 +345,7 @@ module.exports = function(mongoose, config) {
|
|
|
345
345
|
return personId.toString() == idOfPersonToAdd.toString();
|
|
346
346
|
});
|
|
347
347
|
|
|
348
|
-
if (!match) this.people.
|
|
348
|
+
if (!match) this.people = this.people.concat([idOfPersonToAdd]);
|
|
349
349
|
|
|
350
350
|
};
|
|
351
351
|
|
|
@@ -381,7 +381,7 @@ module.exports = function(mongoose, config) {
|
|
|
381
381
|
.exec(cb);
|
|
382
382
|
};
|
|
383
383
|
|
|
384
|
-
LimitedPartner.statics.getById = function(
|
|
384
|
+
LimitedPartner.statics.getById = function(customerId, lpId, role, cb) {
|
|
385
385
|
|
|
386
386
|
var self = this;
|
|
387
387
|
var query;
|
|
@@ -408,11 +408,11 @@ module.exports = function(mongoose, config) {
|
|
|
408
408
|
};
|
|
409
409
|
|
|
410
410
|
if (CUSTOMER_ID == 'GLOBAL_PROCESS') {
|
|
411
|
-
query = self.findById(
|
|
411
|
+
query = self.findById(lpId, self.getReadFilterKeys(role))
|
|
412
412
|
getLp();
|
|
413
413
|
}
|
|
414
414
|
else {
|
|
415
|
-
query = self.findOne({ '_id':
|
|
415
|
+
query = self.findOne({ '_id': lpId, 'customer': customerId, 'transactions.fund': { $in : self.customerFunds }}, self.getReadFilterKeys(role));
|
|
416
416
|
getLp();
|
|
417
417
|
}
|
|
418
418
|
|
|
@@ -444,7 +444,7 @@ module.exports = function(mongoose, config) {
|
|
|
444
444
|
|
|
445
445
|
};
|
|
446
446
|
|
|
447
|
-
LimitedPartner.statics.getByName = function(lpName, role, cb) {
|
|
447
|
+
LimitedPartner.statics.getByName = function(customerId, lpName, role, cb) {
|
|
448
448
|
|
|
449
449
|
var self = this;
|
|
450
450
|
var query;
|
|
@@ -459,7 +459,7 @@ module.exports = function(mongoose, config) {
|
|
|
459
459
|
getLps();
|
|
460
460
|
}
|
|
461
461
|
else {
|
|
462
|
-
query = self.find({'name': lpName, 'transactions.fund': { $in : self.customerFunds }}, self.getReadFilterKeys(role));
|
|
462
|
+
query = self.find({'customer': customerId, 'name': lpName, 'transactions.fund': { $in : self.customerFunds }}, self.getReadFilterKeys(role));
|
|
463
463
|
getLps();
|
|
464
464
|
}
|
|
465
465
|
|
package/lib/List.js
CHANGED
package/lib/Organization.js
CHANGED
|
@@ -570,7 +570,7 @@ module.exports = function(mongoose, config) {
|
|
|
570
570
|
// Add website to website aliases
|
|
571
571
|
// There are unique constraints on website and website aliases
|
|
572
572
|
// This enables us to enforce uniqueness across both and across documents
|
|
573
|
-
if (obj.website && obj.websiteAliases) obj.websiteAliases.
|
|
573
|
+
if (obj.website && obj.websiteAliases) obj.websiteAliases = obj.websiteAliases.concat([obj.website]);
|
|
574
574
|
|
|
575
575
|
if (obj.websiteAliases) {
|
|
576
576
|
obj.websiteAliases = _.uniq(obj.websiteAliases);
|
|
@@ -1068,7 +1068,7 @@ module.exports = function(mongoose, config) {
|
|
|
1068
1068
|
if (dealMatch) { dealMatch = deal; }
|
|
1069
1069
|
|
|
1070
1070
|
// Add the deal
|
|
1071
|
-
else
|
|
1071
|
+
else self.deals = self.deals.concat([deal]);
|
|
1072
1072
|
|
|
1073
1073
|
};
|
|
1074
1074
|
|
|
@@ -1089,7 +1089,7 @@ module.exports = function(mongoose, config) {
|
|
|
1089
1089
|
});
|
|
1090
1090
|
|
|
1091
1091
|
// If not, add it
|
|
1092
|
-
if (!match) self.people.
|
|
1092
|
+
if (!match) self.people = self.people.concat([personToAdd]);
|
|
1093
1093
|
|
|
1094
1094
|
};
|
|
1095
1095
|
|
|
@@ -1117,7 +1117,7 @@ module.exports = function(mongoose, config) {
|
|
|
1117
1117
|
return orgId.toString() == id.toString();
|
|
1118
1118
|
});
|
|
1119
1119
|
|
|
1120
|
-
if (!match)
|
|
1120
|
+
if (!match) self.related = self.related.concat([id]);
|
|
1121
1121
|
|
|
1122
1122
|
};
|
|
1123
1123
|
|
|
@@ -1202,7 +1202,7 @@ module.exports = function(mongoose, config) {
|
|
|
1202
1202
|
|
|
1203
1203
|
var addDealToOrg = function addDealToOrg(previous, callback) {
|
|
1204
1204
|
|
|
1205
|
-
previous.org.deals.
|
|
1205
|
+
previous.org.deals = previous.org.deals.concat([previous.deal]);
|
|
1206
1206
|
|
|
1207
1207
|
self.upsert(previous.org, previous.user.username, function(err, result) {
|
|
1208
1208
|
|
package/lib/Person.js
CHANGED
|
@@ -233,7 +233,7 @@ module.exports = function(mongoose, config) {
|
|
|
233
233
|
};
|
|
234
234
|
|
|
235
235
|
Person.methods.relatePerson = function(id) {
|
|
236
|
-
this.related.
|
|
236
|
+
this.related = this.related.concat([id]);
|
|
237
237
|
};
|
|
238
238
|
|
|
239
239
|
Person.methods.addChairPos = function(chairObj, orgId) {
|
|
@@ -245,11 +245,11 @@ module.exports = function(mongoose, config) {
|
|
|
245
245
|
|
|
246
246
|
switch(chairObj.num) {
|
|
247
247
|
case 'chair1':
|
|
248
|
-
this.chairs.first.
|
|
248
|
+
this.chairs.first = this.chairs.first.concat([chair]);
|
|
249
249
|
break;
|
|
250
250
|
|
|
251
251
|
case 'chair2':
|
|
252
|
-
this.chairs.second.
|
|
252
|
+
this.chairs.second = this.chairs.second.concat([chair]);
|
|
253
253
|
break;
|
|
254
254
|
}
|
|
255
255
|
|
|
@@ -276,12 +276,12 @@ module.exports = function(mongoose, config) {
|
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
if(chairObj.val && chairObj.val == "") {
|
|
279
|
-
this.previous.
|
|
279
|
+
this.previous = this.previous.concat([{
|
|
280
280
|
field: field,
|
|
281
281
|
value: {
|
|
282
282
|
company: orgId
|
|
283
283
|
}
|
|
284
|
-
});
|
|
284
|
+
}]);
|
|
285
285
|
}
|
|
286
286
|
|
|
287
287
|
};
|
|
@@ -459,7 +459,7 @@ module.exports = function(mongoose, config) {
|
|
|
459
459
|
|
|
460
460
|
if (validator.isEmail(data.rawQuery)) {
|
|
461
461
|
if (data.emails.indexOf(data.rawQuery) == -1) {
|
|
462
|
-
data.emails.
|
|
462
|
+
data.emails = data.emails.concat([data.rawQuery]);
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
465
|
|
|
@@ -474,7 +474,7 @@ module.exports = function(mongoose, config) {
|
|
|
474
474
|
|
|
475
475
|
if (pn.isValid()) {
|
|
476
476
|
if (data.phones.indexOf(data.rawQuery) == -1) {
|
|
477
|
-
data.phones.
|
|
477
|
+
data.phones = data.phones.concat([data.rawQuery]);
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
480
|
|
|
@@ -1068,11 +1068,11 @@ module.exports = function(mongoose, config) {
|
|
|
1068
1068
|
|
|
1069
1069
|
switch(chairPos) {
|
|
1070
1070
|
case 'first':
|
|
1071
|
-
person.chairs.first.
|
|
1071
|
+
person.chairs.first = person.chairs.first.concat([chairObj]);
|
|
1072
1072
|
break;
|
|
1073
1073
|
|
|
1074
1074
|
case 'second':
|
|
1075
|
-
person.chairs.second.
|
|
1075
|
+
person.chairs.second = person.chairs.second.concat([chairObj]);
|
|
1076
1076
|
break;
|
|
1077
1077
|
}
|
|
1078
1078
|
|
package/lib/Round.js
CHANGED
|
@@ -315,7 +315,7 @@ module.exports = function(mongoose, config) {
|
|
|
315
315
|
});
|
|
316
316
|
|
|
317
317
|
// If not, add it
|
|
318
|
-
if (!match) vehicle.investments.
|
|
318
|
+
if (!match) vehicle.investments = vehicle.investments.concat([investment]);
|
|
319
319
|
// note there is no need to compute vehicle cost as it is done during upsert
|
|
320
320
|
|
|
321
321
|
};
|
|
@@ -342,9 +342,7 @@ module.exports = function(mongoose, config) {
|
|
|
342
342
|
});
|
|
343
343
|
|
|
344
344
|
// If not, add it
|
|
345
|
-
if (!match) self.people.
|
|
346
|
-
person: person
|
|
347
|
-
});
|
|
345
|
+
if (!match) self.people = self.people.concat([{person: person}]);
|
|
348
346
|
|
|
349
347
|
};
|
|
350
348
|
|
|
@@ -392,7 +390,7 @@ module.exports = function(mongoose, config) {
|
|
|
392
390
|
realized: data.realized,
|
|
393
391
|
valuationDate: data.valuationDate
|
|
394
392
|
};
|
|
395
|
-
self.vehicles.
|
|
393
|
+
self.vehicles = self.vehicles.concat([vehicle]);
|
|
396
394
|
}
|
|
397
395
|
|
|
398
396
|
return vehicle;
|