@dhyasama/totem-models 8.59.1 → 8.60.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/Account.js +1 -0
- package/lib/Activity.js +1 -0
- package/lib/CalendarEvent.js +1 -0
- package/lib/CapTable.js +1 -0
- package/lib/Deal.js +1 -1
- package/lib/Document.js +1 -0
- package/lib/Financials.js +72 -0
- package/lib/Flag.js +1 -0
- package/lib/Fund.js +3 -3
- package/lib/Interaction.js +1 -0
- package/lib/Investment.js +1 -0
- package/lib/LimitedPartner.js +1 -0
- package/lib/List.js +1 -0
- package/lib/Message.js +1 -0
- package/lib/News.js +1 -0
- package/lib/Note.js +1 -0
- package/lib/Organization.js +11 -0
- package/lib/Person.js +1 -1
- package/lib/Round.js +1 -0
- package/lib/Snapshot.js +0 -1
- package/lib/Sync.js +1 -0
- package/lib/Webhook.js +1 -0
- package/package.json +4 -4
- package/test/Financials.js +0 -1
package/lib/Account.js
CHANGED
|
@@ -313,6 +313,7 @@ module.exports = function(mongoose, config) {
|
|
|
313
313
|
|
|
314
314
|
Account.set('usePushEach', true);
|
|
315
315
|
Account.set('autoIndex', false);
|
|
316
|
+
Account.set('usePushEach', true);
|
|
316
317
|
Account.on('index', function(err) { console.log('error building account indexes: ' + err); });
|
|
317
318
|
|
|
318
319
|
mongoose.model('Account', Account);
|
package/lib/Activity.js
CHANGED
|
@@ -125,6 +125,7 @@ module.exports = function(mongoose, config) {
|
|
|
125
125
|
|
|
126
126
|
Activity.set('usePushEach', true);
|
|
127
127
|
Activity.set('autoIndex', false);
|
|
128
|
+
Activity.set('usePushEach', true);
|
|
128
129
|
Activity.on('index', function(err) { console.log('error building activity indexes: ' + err); });
|
|
129
130
|
|
|
130
131
|
mongoose.model('Activity', Activity);
|
package/lib/CalendarEvent.js
CHANGED
|
@@ -179,6 +179,7 @@ module.exports = function(mongoose, config) {
|
|
|
179
179
|
|
|
180
180
|
CalendarEvent.set('usePushEach', true);
|
|
181
181
|
CalendarEvent.set('autoIndex', false);
|
|
182
|
+
CalendarEvent.set('usePushEach', true);
|
|
182
183
|
CalendarEvent.on('index', function(err) { console.log('error building calendar event indexes: ' + err); });
|
|
183
184
|
|
|
184
185
|
mongoose.model('CalendarEvent', CalendarEvent);
|
package/lib/CapTable.js
CHANGED
|
@@ -426,6 +426,7 @@ module.exports = function(mongoose, config) {
|
|
|
426
426
|
|
|
427
427
|
CapTable.set('usePushEach', true);
|
|
428
428
|
CapTable.set('toJSON', { virtuals: true });
|
|
429
|
+
CapTable.set('usePushEach', true);
|
|
429
430
|
CapTable.set('autoIndex', false);
|
|
430
431
|
|
|
431
432
|
CapTable.index({ organization: 1, customer: 1 }, { unique: true, partialFilterExpression : { type :"string" } });
|
package/lib/Deal.js
CHANGED
|
@@ -396,10 +396,10 @@ module.exports = function(mongoose, config) {
|
|
|
396
396
|
// CONFIG
|
|
397
397
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
398
398
|
|
|
399
|
+
Deal.set('usePushEach', true);
|
|
399
400
|
Deal.set('toJSON', { virtuals: true });
|
|
400
401
|
Deal.set('autoIndex', false);
|
|
401
402
|
Deal.set('usePushEach', true);
|
|
402
|
-
|
|
403
403
|
Deal.on('index', function(err) { console.log('error building deal indexes: ' + err); });
|
|
404
404
|
|
|
405
405
|
const deepPopulate = require('mongoose-deep-populate')(mongoose);
|
package/lib/Document.js
CHANGED
|
@@ -205,6 +205,7 @@ module.exports = function(mongoose, config) {
|
|
|
205
205
|
Document.set('usePushEach', true);
|
|
206
206
|
Document.set('toJSON', { virtuals: true });
|
|
207
207
|
Document.set('autoIndex', false);
|
|
208
|
+
Document.set('usePushEach', true);
|
|
208
209
|
Document.on('index', function(err) { console.log('error building document indexes: ' + err); });
|
|
209
210
|
|
|
210
211
|
mongoose.model('Document', Document);
|
package/lib/Financials.js
CHANGED
|
@@ -600,6 +600,78 @@ module.exports = function(mongoose, config) {
|
|
|
600
600
|
|
|
601
601
|
};
|
|
602
602
|
|
|
603
|
+
Financials.statics.getForCustomer = function getForCustomer(customerId, cb) {
|
|
604
|
+
|
|
605
|
+
var self = this;
|
|
606
|
+
|
|
607
|
+
var query = self.find({
|
|
608
|
+
'customer': customerId
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
query.exec(cb);
|
|
612
|
+
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
Financials.statics.getManagedServicesForReview = function getManagedServicesForReview(customerId, cb) {
|
|
616
|
+
|
|
617
|
+
var self = this;
|
|
618
|
+
|
|
619
|
+
var query = self.find({
|
|
620
|
+
'customer': customerId,
|
|
621
|
+
'snapshots': {
|
|
622
|
+
$elemMatch: {
|
|
623
|
+
'managedServices': true,
|
|
624
|
+
'submittedOn': { $ne: null },
|
|
625
|
+
'reviewedOn': null
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
query.populate('organization', 'name');
|
|
631
|
+
|
|
632
|
+
query.exec(function(err, results) {
|
|
633
|
+
|
|
634
|
+
var snapshots = [];
|
|
635
|
+
|
|
636
|
+
_.each(results, function(result) {
|
|
637
|
+
_.each(result.snapshots, function(snapshot) {
|
|
638
|
+
|
|
639
|
+
var isManagedServices = snapshot.managedServices;
|
|
640
|
+
var isSubmitted = snapshot.submittedOn;
|
|
641
|
+
var isNotReviewed = !snapshot.reviewedOn;
|
|
642
|
+
|
|
643
|
+
if(isManagedServices && isSubmitted && isNotReviewed) {
|
|
644
|
+
snapshots.push({
|
|
645
|
+
organization: result.organization.name,
|
|
646
|
+
snapshot: snapshot
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
});
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
if (err) { return cb(err, null); }
|
|
654
|
+
return cb(null, snapshots);
|
|
655
|
+
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
};
|
|
659
|
+
|
|
660
|
+
Financials.statics.getToSend = function getToSend(uuid, cb) {
|
|
661
|
+
|
|
662
|
+
var self = this;
|
|
663
|
+
|
|
664
|
+
var query = self.findOne({
|
|
665
|
+
'snapshots.uuid': uuid
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
query.populate('organization', 'name logoUrl');
|
|
669
|
+
query.populate('customer', 'name logoUrl customer.totemUrl');
|
|
670
|
+
|
|
671
|
+
query.exec(cb);
|
|
672
|
+
|
|
673
|
+
};
|
|
674
|
+
|
|
603
675
|
Financials.statics.removeCustomerFinancials = function removeCustomerFinancials(customerId, cb) {
|
|
604
676
|
|
|
605
677
|
// this is only used to wipe out financials created by the google sheet import process
|
package/lib/Flag.js
CHANGED
|
@@ -120,6 +120,7 @@ module.exports = function(mongoose, config) {
|
|
|
120
120
|
|
|
121
121
|
Flag.set('usePushEach', true);
|
|
122
122
|
Flag.set('autoIndex', false);
|
|
123
|
+
Flag.set('usePushEach', true);
|
|
123
124
|
Flag.on('index', function(err) { console.log('error building Flag indexes: ' + err); });
|
|
124
125
|
|
|
125
126
|
mongoose.model('Flag', Flag);
|
package/lib/Fund.js
CHANGED
|
@@ -10,7 +10,7 @@ module.exports = function(mongoose, config) {
|
|
|
10
10
|
name: { type: String, required: true, unique: true },
|
|
11
11
|
slug: { type: String, required: true, unique: true },
|
|
12
12
|
shortName: { type: String, required: true },
|
|
13
|
-
abbreviation: { type: String
|
|
13
|
+
abbreviation: { type: String },
|
|
14
14
|
spv: { type: Boolean, default: false },
|
|
15
15
|
hexColorCode: { type: String, required: true, default: '#cccccc' },
|
|
16
16
|
closeDate: { type: Date },
|
|
@@ -116,8 +116,7 @@ module.exports = function(mongoose, config) {
|
|
|
116
116
|
if (!query) return cb(null, []);
|
|
117
117
|
|
|
118
118
|
var conditions = {
|
|
119
|
-
'name': new RegExp(query
|
|
120
|
-
'deleted': {$ne: true}
|
|
119
|
+
'name': new RegExp(query, "i")
|
|
121
120
|
};
|
|
122
121
|
|
|
123
122
|
this
|
|
@@ -150,6 +149,7 @@ module.exports = function(mongoose, config) {
|
|
|
150
149
|
|
|
151
150
|
Fund.set('usePushEach', true);
|
|
152
151
|
Fund.set('autoIndex', false);
|
|
152
|
+
Fund.set('usePushEach', true);
|
|
153
153
|
Fund.on('index', function(err) { console.log('error building fund indexes: ' + err); });
|
|
154
154
|
|
|
155
155
|
mongoose.model('Fund', Fund);
|
package/lib/Interaction.js
CHANGED
|
@@ -265,6 +265,7 @@ module.exports = function(mongoose, config) {
|
|
|
265
265
|
|
|
266
266
|
Interaction.set('usePushEach', true);
|
|
267
267
|
Interaction.set('autoIndex', false);
|
|
268
|
+
Interaction.set('usePushEach', true);
|
|
268
269
|
Interaction.on('index', function(err) { console.log('error building interaction indexes: ' + err); });
|
|
269
270
|
|
|
270
271
|
var deepPopulate = require('mongoose-deep-populate')(mongoose);
|
package/lib/Investment.js
CHANGED
|
@@ -119,6 +119,7 @@ module.exports = function(mongoose, config) {
|
|
|
119
119
|
|
|
120
120
|
Investment.set('usePushEach', true);
|
|
121
121
|
Investment.set('toJSON', { virtuals: true });
|
|
122
|
+
Investment.set('usePushEach', true);
|
|
122
123
|
Investment.set('autoIndex', false);
|
|
123
124
|
|
|
124
125
|
Investment.on('index', function(err) { console.log('error building Investment indexes: ' + err); });
|
package/lib/LimitedPartner.js
CHANGED
|
@@ -757,6 +757,7 @@ module.exports = function(mongoose, config) {
|
|
|
757
757
|
|
|
758
758
|
LimitedPartner.set('usePushEach', true);
|
|
759
759
|
LimitedPartner.set('autoIndex', false);
|
|
760
|
+
LimitedPartner.set('usePushEach', true);
|
|
760
761
|
LimitedPartner.on('index', function(err) { console.log('error building limited partner indexes: ' + err); });
|
|
761
762
|
|
|
762
763
|
LimitedPartner.set('toJSON', { virtuals: true });
|
package/lib/List.js
CHANGED
|
@@ -256,6 +256,7 @@ module.exports = function(mongoose, config) {
|
|
|
256
256
|
List.set('autoIndex', (env === 'development'));
|
|
257
257
|
List.set('toJSON', { virtuals: true });
|
|
258
258
|
List.set('autoIndex', false);
|
|
259
|
+
List.set('usePushEach', true);
|
|
259
260
|
List.on('index', function(err) { console.log('error building list indexes: ' + err); });
|
|
260
261
|
|
|
261
262
|
mongoose.model('List', List);
|
package/lib/Message.js
CHANGED
|
@@ -381,6 +381,7 @@ module.exports = function(mongoose, config) {
|
|
|
381
381
|
|
|
382
382
|
Message.set('usePushEach', true);
|
|
383
383
|
Message.set('autoIndex', false);
|
|
384
|
+
Message.set('usePushEach', true);
|
|
384
385
|
Message.set('toJSON', { virtuals: true });
|
|
385
386
|
|
|
386
387
|
let deepPopulate = require('mongoose-deep-populate')(mongoose);
|
package/lib/News.js
CHANGED
|
@@ -70,6 +70,7 @@ module.exports = function(mongoose, config) {
|
|
|
70
70
|
|
|
71
71
|
News.set('usePushEach', true);
|
|
72
72
|
News.set('autoIndex', false);
|
|
73
|
+
News.set('usePushEach', true);
|
|
73
74
|
News.on('index', function(err) { console.log('error building news indexes: ' + err); });
|
|
74
75
|
|
|
75
76
|
mongoose.model('News', News);
|
package/lib/Note.js
CHANGED
|
@@ -129,6 +129,7 @@ module.exports = function(mongoose, config) {
|
|
|
129
129
|
|
|
130
130
|
Note.set('usePushEach', true);
|
|
131
131
|
Note.set('autoIndex', false);
|
|
132
|
+
Note.set('usePushEach', true);
|
|
132
133
|
Note.on('index', function(err) { console.log('error building note indexes: ' + err); });
|
|
133
134
|
|
|
134
135
|
mongoose.model('Note', Note);
|
package/lib/Organization.js
CHANGED
|
@@ -227,6 +227,15 @@ module.exports = function(mongoose, config) {
|
|
|
227
227
|
managedServices: { type: Boolean, default: false },
|
|
228
228
|
greeting: { type: String, trim: true },
|
|
229
229
|
reminders: { type: [Number], default: [7, 7, 7] },
|
|
230
|
+
templates: [{
|
|
231
|
+
_id: false,
|
|
232
|
+
name: { type: String, trim: true },
|
|
233
|
+
form: [{
|
|
234
|
+
_id: false,
|
|
235
|
+
name: { type: String, trim: true },
|
|
236
|
+
type: { type: String, enum: [null, 'block', 'document', 'metric', 'question']}
|
|
237
|
+
}]
|
|
238
|
+
}],
|
|
230
239
|
documents: [{
|
|
231
240
|
_id: false,
|
|
232
241
|
name: { type: String, trim: true },
|
|
@@ -2082,7 +2091,9 @@ module.exports = function(mongoose, config) {
|
|
|
2082
2091
|
|
|
2083
2092
|
Organization.set('usePushEach', true);
|
|
2084
2093
|
Organization.set('toJSON', { virtuals: true });
|
|
2094
|
+
Organization.set('usePushEach', true);
|
|
2085
2095
|
Organization.set('autoIndex', false);
|
|
2096
|
+
Organization.set('usePushEach', true);
|
|
2086
2097
|
|
|
2087
2098
|
Organization.index({ website: 1, websiteAliases: 1 }, { unique: true, partialFilterExpression : { type :"string" } });
|
|
2088
2099
|
Organization.on('index', function(err) { console.log('error building organization_new indexes: ' + err); });
|
package/lib/Person.js
CHANGED
|
@@ -757,7 +757,6 @@ module.exports = function(mongoose, config) {
|
|
|
757
757
|
if (data.phones) query['$or'].push({'contact.phone.number': { $in : data.phones }});
|
|
758
758
|
|
|
759
759
|
query = cleanQuery(query);
|
|
760
|
-
|
|
761
760
|
return query;
|
|
762
761
|
|
|
763
762
|
};
|
|
@@ -1077,6 +1076,7 @@ module.exports = function(mongoose, config) {
|
|
|
1077
1076
|
Person.plugin(deepPopulate);
|
|
1078
1077
|
|
|
1079
1078
|
Person.set('autoIndex', false);
|
|
1079
|
+
Person.set('usePushEach', true);
|
|
1080
1080
|
Person.on('index', function(err) { console.log('error building person indexes: ' + err); });
|
|
1081
1081
|
|
|
1082
1082
|
Person.set('usePushEach', true);
|
package/lib/Round.js
CHANGED
|
@@ -788,6 +788,7 @@ module.exports = function(mongoose, config) {
|
|
|
788
788
|
|
|
789
789
|
Round.set('usePushEach', true);
|
|
790
790
|
Round.set('toJSON', { virtuals: true });
|
|
791
|
+
Round.set('usePushEach', true);
|
|
791
792
|
Round.set('autoIndex', false);
|
|
792
793
|
|
|
793
794
|
Round.index({ organization: 1, roundName: 1 }, { unique: true, partialFilterExpression : { type :"string" } });
|
package/lib/Snapshot.js
CHANGED
package/lib/Sync.js
CHANGED
package/lib/Webhook.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhyasama/totem-models",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.60.0",
|
|
4
4
|
"author": "Jason Reynolds",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"description": "Models for Totem platform",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"awesome-phonenumber": "^1.0.14",
|
|
21
21
|
"bluebird": "^3.7.2",
|
|
22
22
|
"escape-string-regexp": "^1.0.5",
|
|
23
|
-
"moment": "^2.
|
|
24
|
-
"mongoose-deep-populate": "^3.
|
|
23
|
+
"moment": "^2.29.1",
|
|
24
|
+
"mongoose-deep-populate": "^3.2.0",
|
|
25
25
|
"mongoose-filter-denormalize": "^0.2.1",
|
|
26
26
|
"range_check": "^1.4.0",
|
|
27
27
|
"request": "^2.88.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"mocha": "^5.2.0",
|
|
33
33
|
"mocha-mongoose": "^1.2.0",
|
|
34
|
-
"mongoose": "^4.13.
|
|
34
|
+
"mongoose": "^4.13.21",
|
|
35
35
|
"nock": "^7.2.2",
|
|
36
36
|
"should": "^11.1.1"
|
|
37
37
|
}
|