@dhyasama/totem-models 8.72.0 → 8.75.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 +1 -0
- package/lib/Round.js +1 -25
- package/package.json +1 -1
- package/test/Round.js +130 -111
package/lib/LimitedPartner.js
CHANGED
package/lib/Round.js
CHANGED
|
@@ -107,38 +107,14 @@ module.exports = function(mongoose, config) {
|
|
|
107
107
|
|
|
108
108
|
_.each(grouped, function(rounds) {
|
|
109
109
|
|
|
110
|
-
var vehicles = _.flatten(_.pluck(rounds, 'vehicles'));
|
|
111
|
-
var funds = _.flatten(_.pluck(vehicles, 'fund'));
|
|
112
|
-
funds = _.map(funds, function(fund) {
|
|
113
|
-
return {
|
|
114
|
-
name: fund.name,
|
|
115
|
-
shortName: fund.shortName,
|
|
116
|
-
slug: fund.slug,
|
|
117
|
-
_id: fund._id
|
|
118
|
-
};
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
var websites = rounds[0].organization.websiteAliases || [];
|
|
122
|
-
websites.push(rounds[0].organization.website);
|
|
123
|
-
websites = _.compact(websites);
|
|
124
|
-
websites = _.uniq(websites);
|
|
125
|
-
|
|
126
110
|
// construct the org
|
|
127
111
|
var org = {
|
|
128
112
|
_id: rounds[0].organization._id,
|
|
129
113
|
slug: rounds[0].organization.slug,
|
|
130
114
|
name: rounds[0].organization.name,
|
|
131
|
-
aliases: rounds[0].organization.aliases,
|
|
132
115
|
logoUrl: rounds[0].organization.logoUrl,
|
|
133
116
|
description: rounds[0].organization.description,
|
|
134
|
-
|
|
135
|
-
websiteAliases: rounds[0].organization.websiteAliases,
|
|
136
|
-
websites: websites,
|
|
137
|
-
contact: rounds[0].organization.contact,
|
|
138
|
-
filters: rounds[0].organization.filters,
|
|
139
|
-
status: rounds[0].organization.status,
|
|
140
|
-
chairs: rounds[0].organization.chairs,
|
|
141
|
-
funds: funds
|
|
117
|
+
status: rounds[0].organization.status
|
|
142
118
|
};
|
|
143
119
|
|
|
144
120
|
var performance = calculatePerformance(rounds);
|
package/package.json
CHANGED
package/test/Round.js
CHANGED
|
@@ -18,137 +18,156 @@ var personid = new mongoose.Types.ObjectId();
|
|
|
18
18
|
var fundid = new mongoose.Types.ObjectId();
|
|
19
19
|
var organization, organization2, fund, person, investment, investment2;
|
|
20
20
|
|
|
21
|
-
describe('Rounds', function() {
|
|
21
|
+
describe.only('Rounds', function() {
|
|
22
|
+
|
|
23
|
+
config.db.uri = 'mongodb://jason:T576G150HPXLA5q4BJ2o2zj747B5030x@production-shard-00-00-gv0f3.mongodb.net:27017,production-shard-00-01-gv0f3.mongodb.net:27017,production-shard-00-02-gv0f3.mongodb.net:27017/production?replicaSet=Production-shard-0&ssl=true&authSource=admin'
|
|
22
24
|
|
|
23
25
|
before(function(done) {
|
|
24
26
|
if (mongoose.connection.db) return done();
|
|
25
27
|
mongoose.connect(config.db.uri, done);
|
|
26
28
|
});
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
clearDB(done);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
// before(function (done) {
|
|
33
|
-
// Round.collection.dropIndexes(function (err, result) {
|
|
34
|
-
// should.not.exist(err);
|
|
35
|
-
// should.exist(result);
|
|
36
|
-
// result.should.equal(true);
|
|
37
|
-
// return done();
|
|
38
|
-
// });
|
|
39
|
-
// });
|
|
40
|
-
|
|
41
|
-
before(function(done) {
|
|
30
|
+
it.only('test', function(done) {
|
|
42
31
|
|
|
43
|
-
|
|
44
|
-
name: 'Test Fund',
|
|
45
|
-
slug: 'test-fund',
|
|
46
|
-
shortName: 'test',
|
|
47
|
-
abbreviation: 'TF'
|
|
48
|
-
});
|
|
32
|
+
Round.getPortfolioByFunds(['5c7f2e586f076fb7817218a9', '5f5a52b8c077096b8165ba9f'], { CUSTOMER_ID: '5ab961676bb9d7156b17dd4a' }, function(err, result) {
|
|
49
33
|
|
|
50
|
-
Fund.upsert(fund, 'test', function(err, result) {
|
|
51
34
|
should.not.exist(err);
|
|
52
35
|
should.exist(result);
|
|
53
|
-
fund = result;
|
|
54
|
-
done();
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
before(function(done) {
|
|
60
36
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
last: 'James'
|
|
65
|
-
},
|
|
66
|
-
slug: 'jim-james'
|
|
67
|
-
});
|
|
37
|
+
_.each(result, function(item) {
|
|
38
|
+
console.log(item.name);
|
|
39
|
+
})
|
|
68
40
|
|
|
69
|
-
Person.upsert(person, 'test', function(err, result) {
|
|
70
|
-
should.not.exist(err);
|
|
71
|
-
should.exist(result);
|
|
72
|
-
person = result;
|
|
73
41
|
done();
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
before(function(done) {
|
|
79
|
-
|
|
80
|
-
organization = new Organization({
|
|
81
|
-
name: 'Test Org',
|
|
82
|
-
slug: 'test-org',
|
|
83
|
-
website: 'testorg.com'
|
|
84
|
-
});
|
|
85
42
|
|
|
86
|
-
organization2 = new Organization({
|
|
87
|
-
name: 'Dope Org',
|
|
88
|
-
slug: 'dope-org',
|
|
89
|
-
website: 'dopeorg.com',
|
|
90
|
-
description: 'mad dope',
|
|
91
|
-
logoUrl: 'https://logo.dopeorg.com',
|
|
92
|
-
status: 'Active'
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
Organization.upsert(organization, 'test', function(err, result) {
|
|
96
|
-
should.not.exist(err);
|
|
97
|
-
should.exist(result);
|
|
98
|
-
organization = result;
|
|
99
|
-
Organization.upsert(organization2, 'test', function(err, result) {
|
|
100
|
-
should.not.exist(err);
|
|
101
|
-
should.exist(result);
|
|
102
|
-
organization2 = result;
|
|
103
|
-
done();
|
|
104
|
-
});
|
|
105
43
|
});
|
|
106
44
|
|
|
107
45
|
});
|
|
108
46
|
|
|
109
|
-
before(function(done) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
customer: organization,
|
|
113
|
-
cost: 200000,
|
|
114
|
-
costPlusInterest: 200000,
|
|
115
|
-
investmentDate: Date.now(),
|
|
116
|
-
pricePerShare: 0.002,
|
|
117
|
-
preMoneyValuation: 1000000,
|
|
118
|
-
dollarsRaised: 200000,
|
|
119
|
-
closingDate: Date.now()
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
Investment.upsert(inv, function(err, result) {
|
|
123
|
-
should.not.exist(err);
|
|
124
|
-
should.exist(result);
|
|
125
|
-
investment = result;
|
|
126
|
-
done();
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
before(function(done) {
|
|
132
|
-
|
|
133
|
-
var inv = new Investment({
|
|
134
|
-
customer: organization,
|
|
135
|
-
cost: 200000,
|
|
136
|
-
costPlusInterest: 200000,
|
|
137
|
-
investmentDate: Date.now(),
|
|
138
|
-
pricePerShare: 0.002,
|
|
139
|
-
preMoneyValuation: 1000000,
|
|
140
|
-
dollarsRaised: 200000,
|
|
141
|
-
closingDate: Date.now()
|
|
142
|
-
});
|
|
47
|
+
// before(function(done) {
|
|
48
|
+
// clearDB(done);
|
|
49
|
+
// });
|
|
143
50
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
51
|
+
// before(function (done) {
|
|
52
|
+
// Round.collection.dropIndexes(function (err, result) {
|
|
53
|
+
// should.not.exist(err);
|
|
54
|
+
// should.exist(result);
|
|
55
|
+
// result.should.equal(true);
|
|
56
|
+
// return done();
|
|
57
|
+
// });
|
|
58
|
+
// });
|
|
150
59
|
|
|
151
|
-
|
|
60
|
+
// before(function(done) {
|
|
61
|
+
//
|
|
62
|
+
// fund = new Fund({
|
|
63
|
+
// name: 'Test Fund',
|
|
64
|
+
// slug: 'test-fund',
|
|
65
|
+
// shortName: 'test',
|
|
66
|
+
// abbreviation: 'TF'
|
|
67
|
+
// });
|
|
68
|
+
//
|
|
69
|
+
// Fund.upsert(fund, 'test', function(err, result) {
|
|
70
|
+
// should.not.exist(err);
|
|
71
|
+
// should.exist(result);
|
|
72
|
+
// fund = result;
|
|
73
|
+
// done();
|
|
74
|
+
// });
|
|
75
|
+
//
|
|
76
|
+
// });
|
|
77
|
+
//
|
|
78
|
+
// before(function(done) {
|
|
79
|
+
//
|
|
80
|
+
// person = new Person({
|
|
81
|
+
// name: {
|
|
82
|
+
// first: 'Jim',
|
|
83
|
+
// last: 'James'
|
|
84
|
+
// },
|
|
85
|
+
// slug: 'jim-james'
|
|
86
|
+
// });
|
|
87
|
+
//
|
|
88
|
+
// Person.upsert(person, 'test', function(err, result) {
|
|
89
|
+
// should.not.exist(err);
|
|
90
|
+
// should.exist(result);
|
|
91
|
+
// person = result;
|
|
92
|
+
// done();
|
|
93
|
+
// });
|
|
94
|
+
//
|
|
95
|
+
// });
|
|
96
|
+
//
|
|
97
|
+
// before(function(done) {
|
|
98
|
+
//
|
|
99
|
+
// organization = new Organization({
|
|
100
|
+
// name: 'Test Org',
|
|
101
|
+
// slug: 'test-org',
|
|
102
|
+
// website: 'testorg.com'
|
|
103
|
+
// });
|
|
104
|
+
//
|
|
105
|
+
// organization2 = new Organization({
|
|
106
|
+
// name: 'Dope Org',
|
|
107
|
+
// slug: 'dope-org',
|
|
108
|
+
// website: 'dopeorg.com',
|
|
109
|
+
// description: 'mad dope',
|
|
110
|
+
// logoUrl: 'https://logo.dopeorg.com',
|
|
111
|
+
// status: 'Active'
|
|
112
|
+
// });
|
|
113
|
+
//
|
|
114
|
+
// Organization.upsert(organization, 'test', function(err, result) {
|
|
115
|
+
// should.not.exist(err);
|
|
116
|
+
// should.exist(result);
|
|
117
|
+
// organization = result;
|
|
118
|
+
// Organization.upsert(organization2, 'test', function(err, result) {
|
|
119
|
+
// should.not.exist(err);
|
|
120
|
+
// should.exist(result);
|
|
121
|
+
// organization2 = result;
|
|
122
|
+
// done();
|
|
123
|
+
// });
|
|
124
|
+
// });
|
|
125
|
+
//
|
|
126
|
+
// });
|
|
127
|
+
//
|
|
128
|
+
// before(function(done) {
|
|
129
|
+
//
|
|
130
|
+
// var inv = new Investment({
|
|
131
|
+
// customer: organization,
|
|
132
|
+
// cost: 200000,
|
|
133
|
+
// costPlusInterest: 200000,
|
|
134
|
+
// investmentDate: Date.now(),
|
|
135
|
+
// pricePerShare: 0.002,
|
|
136
|
+
// preMoneyValuation: 1000000,
|
|
137
|
+
// dollarsRaised: 200000,
|
|
138
|
+
// closingDate: Date.now()
|
|
139
|
+
// });
|
|
140
|
+
//
|
|
141
|
+
// Investment.upsert(inv, function(err, result) {
|
|
142
|
+
// should.not.exist(err);
|
|
143
|
+
// should.exist(result);
|
|
144
|
+
// investment = result;
|
|
145
|
+
// done();
|
|
146
|
+
// });
|
|
147
|
+
//
|
|
148
|
+
// });
|
|
149
|
+
//
|
|
150
|
+
// before(function(done) {
|
|
151
|
+
//
|
|
152
|
+
// var inv = new Investment({
|
|
153
|
+
// customer: organization,
|
|
154
|
+
// cost: 200000,
|
|
155
|
+
// costPlusInterest: 200000,
|
|
156
|
+
// investmentDate: Date.now(),
|
|
157
|
+
// pricePerShare: 0.002,
|
|
158
|
+
// preMoneyValuation: 1000000,
|
|
159
|
+
// dollarsRaised: 200000,
|
|
160
|
+
// closingDate: Date.now()
|
|
161
|
+
// });
|
|
162
|
+
//
|
|
163
|
+
// Investment.upsert(inv, function(err, result) {
|
|
164
|
+
// should.not.exist(err);
|
|
165
|
+
// should.exist(result);
|
|
166
|
+
// investment2 = result;
|
|
167
|
+
// done();
|
|
168
|
+
// });
|
|
169
|
+
//
|
|
170
|
+
// });
|
|
152
171
|
|
|
153
172
|
it('creates a round', function(done) {
|
|
154
173
|
|