@dhyasama/totem-models 1.7.0 → 1.8.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 +11 -0
- package/lib/Investment.js +14 -0
- package/lib/Organization.js +4 -2
- package/package.json +1 -1
- package/test/List.js +9 -0
package/lib/CapTable.js
CHANGED
|
@@ -254,6 +254,17 @@ module.exports = function(mongoose, config) {
|
|
|
254
254
|
|
|
255
255
|
};
|
|
256
256
|
|
|
257
|
+
CapTable.statics.getByFunds = function getByFunds(fundIds, cb) {
|
|
258
|
+
|
|
259
|
+
var self = this;
|
|
260
|
+
|
|
261
|
+
self
|
|
262
|
+
.find({ 'stakeholder.fund': { $in: fundIds } })
|
|
263
|
+
.populate('organization', 'name logoUrl')
|
|
264
|
+
.exec(cb);
|
|
265
|
+
|
|
266
|
+
};
|
|
267
|
+
|
|
257
268
|
CapTable.statics.getForCustomer = function getForCustomer(orgId, customerId, cb) {
|
|
258
269
|
|
|
259
270
|
var self = this;
|
package/lib/Investment.js
CHANGED
|
@@ -46,6 +46,20 @@ module.exports = function(mongoose, config) {
|
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
|
|
49
|
+
converted: { type: Boolean, default: false },
|
|
50
|
+
convertedInto: {
|
|
51
|
+
type: String,
|
|
52
|
+
trim: true,
|
|
53
|
+
validate: {
|
|
54
|
+
validator: function(v) {
|
|
55
|
+
var self = this;
|
|
56
|
+
if (self.converted && (!v || v.length == 0)) return false;
|
|
57
|
+
else return true;
|
|
58
|
+
},
|
|
59
|
+
message: 'The investments is marked as converted but a converted into value was not provided! Either set converted to false or provide a value for converted into.'
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
|
|
49
63
|
// Catch-all for customer specific key-value pairs from sheet that aren't supported by our schema
|
|
50
64
|
details: [{
|
|
51
65
|
key: { type: String, trim: true, required: true },
|
package/lib/Organization.js
CHANGED
|
@@ -68,6 +68,8 @@ module.exports = function(mongoose, config) {
|
|
|
68
68
|
board: { type: String, enum: ['chairman', 'director', 'observer', 'none'], default: 'none', index: true }
|
|
69
69
|
}],
|
|
70
70
|
|
|
71
|
+
lps: [{ type: Schema.ObjectId, ref: 'LimitedPartner' }],
|
|
72
|
+
|
|
71
73
|
entered: {
|
|
72
74
|
by: { type: String, default: '', trim: true },
|
|
73
75
|
on: { type: Date, default: Date.now }
|
|
@@ -620,7 +622,7 @@ module.exports = function(mongoose, config) {
|
|
|
620
622
|
}
|
|
621
623
|
}
|
|
622
624
|
})
|
|
623
|
-
.select('name
|
|
625
|
+
.select('name logoUrl people')
|
|
624
626
|
.exec(cb);
|
|
625
627
|
|
|
626
628
|
};
|
|
@@ -999,7 +1001,7 @@ module.exports = function(mongoose, config) {
|
|
|
999
1001
|
|
|
1000
1002
|
// if not public, keep it in if org is in the current customer's portfolio. otherwise remove it.
|
|
1001
1003
|
// todo
|
|
1002
|
-
console.log(customerPortfolio);
|
|
1004
|
+
//console.log(customerPortfolio);
|
|
1003
1005
|
|
|
1004
1006
|
});
|
|
1005
1007
|
|
package/package.json
CHANGED
package/test/List.js
CHANGED
|
@@ -28,6 +28,15 @@ describe('List', function() {
|
|
|
28
28
|
clearDB(done);
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
+
before(function (done) {
|
|
32
|
+
Person.collection.dropIndexes(function (err, result) {
|
|
33
|
+
should.not.exist(err);
|
|
34
|
+
should.exist(result);
|
|
35
|
+
result.should.equal(true);
|
|
36
|
+
return done();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
31
40
|
before(function(done) {
|
|
32
41
|
|
|
33
42
|
lp = new LimitedPartner();
|