@dhyasama/totem-models 1.6.3 → 1.7.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/CapTable.js +1 -1
- package/lib/Organization.js +19 -19
- package/lib/Person.js +11 -5
- package/lib/Round.js +4 -2
- package/package.json +1 -1
- package/test/Person.js +9 -0
package/lib/CapTable.js
CHANGED
|
@@ -387,7 +387,7 @@ module.exports = function(mongoose, config) {
|
|
|
387
387
|
CapTable.set('toJSON', { virtuals: true });
|
|
388
388
|
CapTable.set('autoIndex', true);
|
|
389
389
|
|
|
390
|
-
CapTable.index({ organization: 1, customer: 1 }, { unique: true,
|
|
390
|
+
CapTable.index({ organization: 1, customer: 1 }, { unique: true, partialFilterExpression : { type :"string" } });
|
|
391
391
|
CapTable.on('index', function(err) { console.log('error building CapTable indexes: ' + err); });
|
|
392
392
|
|
|
393
393
|
mongoose.model('CapTable', CapTable);
|
package/lib/Organization.js
CHANGED
|
@@ -16,20 +16,20 @@ module.exports = function(mongoose, config) {
|
|
|
16
16
|
|
|
17
17
|
name: { type: String, required: true, index: true },
|
|
18
18
|
|
|
19
|
-
slug: { type: String, required: true, unique: true,
|
|
19
|
+
slug: { type: String, required: true, unique: true, trim: true, lowercase: true },
|
|
20
20
|
|
|
21
21
|
logoUrl: { type: String, trim: true },
|
|
22
22
|
|
|
23
23
|
description: { type: String, trim: true },
|
|
24
24
|
|
|
25
|
-
website: { type: String, unique: true,
|
|
25
|
+
website: { type: String, unique: true, partialFilterExpression : { type :"string" }, required: false, trim: true, lowercase: true },
|
|
26
26
|
|
|
27
|
-
websiteAliases: [ { type: String, unique: true,
|
|
27
|
+
websiteAliases: [ { type: String, unique: true, partialFilterExpression : { type :"string" }, trim: true, lowercase: true } ],
|
|
28
28
|
|
|
29
29
|
social: {
|
|
30
|
-
twitter: { type: String, trim: true, unique: true,
|
|
31
|
-
facebook: { type: String, trim: true, unique: true,
|
|
32
|
-
linkedin: { type: String, trim: true, unique: true,
|
|
30
|
+
twitter: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
|
|
31
|
+
facebook: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
|
|
32
|
+
linkedin: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } }
|
|
33
33
|
},
|
|
34
34
|
|
|
35
35
|
contact: {
|
|
@@ -111,8 +111,8 @@ module.exports = function(mongoose, config) {
|
|
|
111
111
|
}],
|
|
112
112
|
|
|
113
113
|
crunchbase: {
|
|
114
|
-
uuid: { type: String, unique: true,
|
|
115
|
-
url: { type: String, unique: true,
|
|
114
|
+
uuid: { type: String, unique: true, partialFilterExpression : { type : "string" }, trim: true },
|
|
115
|
+
url: { type: String, unique: true, partialFilterExpression : { type :"string" }, trim: true }
|
|
116
116
|
},
|
|
117
117
|
|
|
118
118
|
related: [{ type: Schema.ObjectId, ref: 'Organization' }],
|
|
@@ -124,7 +124,7 @@ module.exports = function(mongoose, config) {
|
|
|
124
124
|
|
|
125
125
|
active: { type: Boolean, default: false },
|
|
126
126
|
|
|
127
|
-
totemUrl: { type: String, trim: true, unique: true,
|
|
127
|
+
totemUrl: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
|
|
128
128
|
|
|
129
129
|
style: {
|
|
130
130
|
backgroundColor: { type: String, default: '#666666', trim: true },
|
|
@@ -132,32 +132,32 @@ module.exports = function(mongoose, config) {
|
|
|
132
132
|
},
|
|
133
133
|
|
|
134
134
|
investmentsSheet: {
|
|
135
|
-
sheet: { type: String, trim: true, unique: true,
|
|
135
|
+
sheet: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
|
|
136
136
|
googleSheetCreds: {
|
|
137
|
-
private_key_id: { type: String, trim: true, unique: true,
|
|
138
|
-
private_key: { type: String, trim: true, unique: true,
|
|
139
|
-
client_email: { type: String, trim: true, unique: true,
|
|
140
|
-
client_id: { type: String, trim: true, unique: true,
|
|
137
|
+
private_key_id: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
|
|
138
|
+
private_key: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
|
|
139
|
+
client_email: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
|
|
140
|
+
client_id: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
|
|
141
141
|
type: { type: String, trim: true }
|
|
142
142
|
}
|
|
143
143
|
},
|
|
144
144
|
|
|
145
145
|
eshares: {
|
|
146
|
-
firmid: { type: String, unique: true,
|
|
146
|
+
firmid: { type: String, unique: true, partialFilterExpression : { type :"string" }, trim: true }
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
},
|
|
150
150
|
|
|
151
151
|
docs: [{
|
|
152
152
|
customer: { type: Schema.ObjectId, ref: 'Organization' },
|
|
153
|
-
url: { type: String, trim: true, unique: true,
|
|
153
|
+
url: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } }
|
|
154
154
|
}],
|
|
155
155
|
|
|
156
156
|
// Link to deeper data on iLevel
|
|
157
157
|
// iLevelUser must be true at the account level
|
|
158
158
|
iLevel: [{
|
|
159
159
|
customer: { type: Schema.ObjectId, ref: 'Organization' },
|
|
160
|
-
url: { type: String, trim: true, unique: true,
|
|
160
|
+
url: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } }
|
|
161
161
|
}],
|
|
162
162
|
|
|
163
163
|
chairs: [{
|
|
@@ -505,7 +505,7 @@ module.exports = function(mongoose, config) {
|
|
|
505
505
|
var self = this;
|
|
506
506
|
self
|
|
507
507
|
.find({ 'funds': { $in : fundids }, 'deleted': {$ne: true} })
|
|
508
|
-
.select('name logoUrl')
|
|
508
|
+
.select('name logoUrl funds')
|
|
509
509
|
.exec(cb);
|
|
510
510
|
};
|
|
511
511
|
|
|
@@ -1016,7 +1016,7 @@ module.exports = function(mongoose, config) {
|
|
|
1016
1016
|
Organization.set('toJSON', { virtuals: true });
|
|
1017
1017
|
Organization.set('autoIndex', true);
|
|
1018
1018
|
|
|
1019
|
-
Organization.index({ website: 1, websiteAliases: 1 }, { unique: true,
|
|
1019
|
+
Organization.index({ website: 1, websiteAliases: 1 }, { unique: true, partialFilterExpression : { type :"string" } });
|
|
1020
1020
|
Organization.on('index', function(err) { console.log('error building organization_new indexes: ' + err); });
|
|
1021
1021
|
|
|
1022
1022
|
var deepPopulate = require('mongoose-deep-populate')(mongoose);
|
package/lib/Person.js
CHANGED
|
@@ -29,7 +29,7 @@ module.exports = function(mongoose, config) {
|
|
|
29
29
|
last: { type: String, default: '', index: true }
|
|
30
30
|
},
|
|
31
31
|
|
|
32
|
-
slug: { type: String, required: true, unique: true,
|
|
32
|
+
slug: { type: String, required: true, unique: true, trim: true, lowercase: true },
|
|
33
33
|
|
|
34
34
|
contact: {
|
|
35
35
|
|
|
@@ -67,15 +67,15 @@ module.exports = function(mongoose, config) {
|
|
|
67
67
|
website: { type: String, default: null, required: false, trim: true, lowercase: true },
|
|
68
68
|
|
|
69
69
|
crunchbase: {
|
|
70
|
-
uuid: { type: String, unique: true, required: false,
|
|
70
|
+
uuid: { type: String, unique: true, required: false, partialFilterExpression : { type :"string" }, trim: true }
|
|
71
71
|
},
|
|
72
72
|
|
|
73
73
|
vCardUrl: { type: String, default: null, trim: true },
|
|
74
74
|
|
|
75
75
|
social: {
|
|
76
|
-
twitter: { type: String, trim: true, unique: true,
|
|
77
|
-
facebook: { type: String, trim: true, unique: true,
|
|
78
|
-
linkedin: { type: String, trim: true, unique: true,
|
|
76
|
+
twitter: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
|
|
77
|
+
facebook: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
|
|
78
|
+
linkedin: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } }
|
|
79
79
|
},
|
|
80
80
|
|
|
81
81
|
avatarUrl: { type: String, default: null, trim: true },
|
|
@@ -120,6 +120,9 @@ module.exports = function(mongoose, config) {
|
|
|
120
120
|
|
|
121
121
|
aliases: [ { type: String, trim: true } ],
|
|
122
122
|
|
|
123
|
+
// handy for searching
|
|
124
|
+
fullName: { type: String, index: true, trim: true },
|
|
125
|
+
|
|
123
126
|
related: [{ type: Schema.ObjectId, ref: 'Person' }],
|
|
124
127
|
|
|
125
128
|
calendarEventSummaries: [
|
|
@@ -1032,6 +1035,9 @@ module.exports = function(mongoose, config) {
|
|
|
1032
1035
|
|
|
1033
1036
|
var self = this;
|
|
1034
1037
|
|
|
1038
|
+
// set full name for ease of searching
|
|
1039
|
+
self.fullName = self.name.first + ' ' + self.name.last;
|
|
1040
|
+
|
|
1035
1041
|
// Reset counters so we can calc from scratch
|
|
1036
1042
|
_.each(self.sources, function(source) {
|
|
1037
1043
|
source.interactions.calendar = 0;
|
package/lib/Round.js
CHANGED
|
@@ -137,6 +137,8 @@ module.exports = function(mongoose, config) {
|
|
|
137
137
|
name: rounds[0].organization.name,
|
|
138
138
|
logoUrl: rounds[0].organization.logoUrl,
|
|
139
139
|
description: rounds[0].organization.description,
|
|
140
|
+
contact: rounds[0].organization.contact,
|
|
141
|
+
industries: rounds[0].organization.industries,
|
|
140
142
|
status: rounds[0].organization.status,
|
|
141
143
|
preMoneyValuation: rounds[0].preMoneyValuation
|
|
142
144
|
};
|
|
@@ -554,7 +556,7 @@ module.exports = function(mongoose, config) {
|
|
|
554
556
|
self
|
|
555
557
|
.find({ 'vehicles.fund': { $in: fundIds } })
|
|
556
558
|
.select('organization vehicles preMoneyValuation')
|
|
557
|
-
.populate('organization', 'name logoUrl description')
|
|
559
|
+
.populate('organization', 'name logoUrl description contact industries')
|
|
558
560
|
.populate('vehicles.fund')
|
|
559
561
|
.populate('vehicles.investments')
|
|
560
562
|
.exec(function(err, rounds) {
|
|
@@ -795,7 +797,7 @@ module.exports = function(mongoose, config) {
|
|
|
795
797
|
Round.set('toJSON', { virtuals: true });
|
|
796
798
|
Round.set('autoIndex', true);
|
|
797
799
|
|
|
798
|
-
Round.index({ organization: 1, roundName: 1 }, { unique: true,
|
|
800
|
+
Round.index({ organization: 1, roundName: 1 }, { unique: true, partialFilterExpression : { type :"string" } });
|
|
799
801
|
Round.on('index', function(err) { console.log('error building Round indexes: ' + err); });
|
|
800
802
|
|
|
801
803
|
mongoose.model('Round', Round);
|
package/package.json
CHANGED
package/test/Person.js
CHANGED
|
@@ -53,6 +53,15 @@ describe('Person', function() {
|
|
|
53
53
|
clearDB(done);
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
+
before(function (done) {
|
|
57
|
+
Person.collection.dropIndexes(function (err, result) {
|
|
58
|
+
should.not.exist(err);
|
|
59
|
+
should.exist(result);
|
|
60
|
+
result.should.equal(true);
|
|
61
|
+
return done();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
56
65
|
before(function (done) {
|
|
57
66
|
LimitedPartner.collection.dropIndexes(function (err, result) {
|
|
58
67
|
should.not.exist(err);
|