@dhyasama/totem-models 6.28.0 → 6.29.1
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/Financials.js +36 -15
- package/lib/Investment.js +1 -1
- package/package.json +1 -1
package/lib/Financials.js
CHANGED
|
@@ -12,9 +12,9 @@ module.exports = function(mongoose, config) {
|
|
|
12
12
|
var Schema = mongoose.Schema;
|
|
13
13
|
var async = require('async');
|
|
14
14
|
var _ = require('underscore');
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
var Financials = new Schema({
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
organization: { type: Schema.ObjectId, ref: 'Organization', required: true, index: true },
|
|
19
19
|
|
|
20
20
|
customer: { type: Schema.ObjectId, ref: 'Organization', required: true, index: true },
|
|
@@ -24,7 +24,9 @@ module.exports = function(mongoose, config) {
|
|
|
24
24
|
currency: { type: String, required: true, default: 'USD' },
|
|
25
25
|
|
|
26
26
|
snapshots: [{
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
uuid: { type: String },
|
|
29
|
+
|
|
28
30
|
year: { type: Number, default: 0 },
|
|
29
31
|
quarter: { type: String, enum: ['all', 'q1', 'q2', 'q3', 'q4'] },
|
|
30
32
|
|
|
@@ -49,7 +51,7 @@ module.exports = function(mongoose, config) {
|
|
|
49
51
|
projected: { type: Number, default: 0 },
|
|
50
52
|
breakdown: [{
|
|
51
53
|
key: { type: String, trim: true },
|
|
52
|
-
value: { type:
|
|
54
|
+
value: { type: Number },
|
|
53
55
|
_id: false
|
|
54
56
|
}]
|
|
55
57
|
},
|
|
@@ -58,7 +60,7 @@ module.exports = function(mongoose, config) {
|
|
|
58
60
|
projected: { type: Number, default: 0 },
|
|
59
61
|
breakdown: [{
|
|
60
62
|
key: { type: String, trim: true },
|
|
61
|
-
value: { type:
|
|
63
|
+
value: { type: Number },
|
|
62
64
|
_id: false
|
|
63
65
|
}]
|
|
64
66
|
},
|
|
@@ -67,7 +69,7 @@ module.exports = function(mongoose, config) {
|
|
|
67
69
|
projected: { type: Number, default: 0 },
|
|
68
70
|
breakdown: [{
|
|
69
71
|
key: { type: String, trim: true },
|
|
70
|
-
value: { type:
|
|
72
|
+
value: { type: Number },
|
|
71
73
|
_id: false
|
|
72
74
|
}]
|
|
73
75
|
},
|
|
@@ -76,7 +78,7 @@ module.exports = function(mongoose, config) {
|
|
|
76
78
|
projected: { type: Number, default: 0 },
|
|
77
79
|
breakdown: [{
|
|
78
80
|
key: { type: String, trim: true },
|
|
79
|
-
value: { type:
|
|
81
|
+
value: { type: Number },
|
|
80
82
|
_id: false
|
|
81
83
|
}]
|
|
82
84
|
},
|
|
@@ -84,12 +86,18 @@ module.exports = function(mongoose, config) {
|
|
|
84
86
|
// Catch-all for customer specific key-value pairs from sheet that aren't supported by our schema
|
|
85
87
|
details: [{
|
|
86
88
|
key: { type: String, trim: true },
|
|
87
|
-
value: { type:
|
|
89
|
+
value: { type: Number },
|
|
88
90
|
_id: false
|
|
89
|
-
}]
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
}],
|
|
92
|
+
|
|
93
|
+
comment: { type: String, trim: true },
|
|
94
|
+
documents: [ { type: Schema.ObjectId, ref: 'Document' } ],
|
|
92
95
|
|
|
96
|
+
submittedOn: { type: Date, index: false },
|
|
97
|
+
submittedBy: { type: String, trim: true }
|
|
98
|
+
|
|
99
|
+
}],
|
|
100
|
+
|
|
93
101
|
});
|
|
94
102
|
|
|
95
103
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -117,6 +125,20 @@ module.exports = function(mongoose, config) {
|
|
|
117
125
|
|
|
118
126
|
};
|
|
119
127
|
|
|
128
|
+
Financials.statics.getByUUID = function getByUUID(uuid, cb) {
|
|
129
|
+
|
|
130
|
+
var self = this;
|
|
131
|
+
|
|
132
|
+
var query = self.find({
|
|
133
|
+
'snapshots.uuid': uuid,
|
|
134
|
+
'customer': config.CUSTOMER_ID
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
query.populate('organization', 'name logoUrl')
|
|
138
|
+
query.exec(cb);
|
|
139
|
+
|
|
140
|
+
};
|
|
141
|
+
|
|
120
142
|
Financials.statics.removeCustomerFinancials = function removeCustomerFinancials(customerId, cb) {
|
|
121
143
|
|
|
122
144
|
var self = this;
|
|
@@ -129,11 +151,12 @@ module.exports = function(mongoose, config) {
|
|
|
129
151
|
|
|
130
152
|
Financials.statics.upsert = function upsert(financials, cb) {
|
|
131
153
|
if (!financials) { return cb(new Error('financials is required'), null); }
|
|
132
|
-
financials.save(
|
|
154
|
+
financials.save(function(err, result) {
|
|
155
|
+
return cb(null, result);
|
|
156
|
+
});
|
|
133
157
|
};
|
|
134
158
|
|
|
135
159
|
|
|
136
|
-
|
|
137
160
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
138
161
|
// HOOKS
|
|
139
162
|
// Pre-save: fired on every document before it is saved
|
|
@@ -175,5 +198,3 @@ module.exports = function(mongoose, config) {
|
|
|
175
198
|
mongoose.model('Financials', Financials);
|
|
176
199
|
|
|
177
200
|
};
|
|
178
|
-
|
|
179
|
-
|
package/lib/Investment.js
CHANGED
|
@@ -33,7 +33,7 @@ module.exports = function(mongoose, config) {
|
|
|
33
33
|
debt: { type: Boolean, default: false },
|
|
34
34
|
debtType: {
|
|
35
35
|
type: String,
|
|
36
|
-
enum: [ 'Convertible Note', 'SAFE', 'SAFT', 'KISS', null ],
|
|
36
|
+
enum: [ 'Convertible Note', 'SAFE', 'SAFT', 'SAFTE', 'KISS', null ],
|
|
37
37
|
default: null,
|
|
38
38
|
required: false,
|
|
39
39
|
validate: {
|