@dhyasama/totem-models 7.32.0 → 7.34.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/Investment.js +6 -1
- package/package.json +1 -1
package/lib/Investment.js
CHANGED
|
@@ -63,7 +63,8 @@ module.exports = function(mongoose, config) {
|
|
|
63
63
|
// Catch-all for customer specific key-value pairs from sheet that aren't supported by our schema
|
|
64
64
|
details: [{
|
|
65
65
|
key: { type: String, trim: true, required: true },
|
|
66
|
-
value: { type:
|
|
66
|
+
value: { type: Schema.Types.Mixed, required: true },
|
|
67
|
+
format: { type: String, enum: [null, 'number', 'decimal', 'money', 'percentage', 'date']},
|
|
67
68
|
_id: false
|
|
68
69
|
}],
|
|
69
70
|
|
|
@@ -129,6 +130,10 @@ module.exports = function(mongoose, config) {
|
|
|
129
130
|
};
|
|
130
131
|
|
|
131
132
|
Investment.statics.upsert = function upsert(investment, cb) {
|
|
133
|
+
|
|
134
|
+
// Required for mixed types
|
|
135
|
+
investment.markModified('details');
|
|
136
|
+
|
|
132
137
|
if (!investment) { return cb(new Error('investment is required'), null); }
|
|
133
138
|
investment.save(cb);
|
|
134
139
|
};
|