@dhyasama/totem-models 7.5.1 → 7.6.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/Financials.js CHANGED
@@ -90,24 +90,8 @@ module.exports = function(mongoose, config) {
90
90
  }]
91
91
  },
92
92
 
93
- metrics: [{
94
- key: { type: String, trim: true },
95
- value: { type: Number },
96
- _id: false
97
- }],
98
-
99
- questions: [{
100
- key: { type: String, trim: true },
101
- value: { type: String, trim: true },
102
- _id: false
103
- }],
104
-
105
- // Catch-all for customer specific key-value pairs from sheet that aren't supported by our schema
106
- details: [{
107
- key: { type: String, trim: true },
108
- value: { type: String, trim: true },
109
- _id: false
110
- }],
93
+ kpis: { type: Schema.Types.Mixed },
94
+ questions: { type: Schema.Types.Mixed },
111
95
 
112
96
  comment: { type: String, trim: true },
113
97
  documents: [ { type: Schema.ObjectId, ref: 'Document' } ],
@@ -360,6 +344,10 @@ module.exports = function(mongoose, config) {
360
344
 
361
345
  if (!financials) { return cb(new Error('financials is required'), null); }
362
346
 
347
+ // Required for mixed types
348
+ financials.markModified('kpis');
349
+ financials.markModified('questions');
350
+
363
351
  financials.save(cb);
364
352
 
365
353
  };
@@ -215,8 +215,14 @@ module.exports = function(mongoose, config) {
215
215
 
216
216
  financials : {
217
217
  active: { type: Boolean, default: false },
218
- questions: [{ type: String, trim: true }],
219
- metrics: [{ type: String, trim: true }],
218
+ kpis: [{
219
+ name: { type: String, trim: true },
220
+ description: { type: String, trim: true },
221
+ format: { type: String, trim: true },
222
+ }],
223
+ questions: [{
224
+ prompt: { type: String, enum: [null, 'number', 'money', 'percentage', 'variance']},
225
+ }],
220
226
  },
221
227
 
222
228
  irr: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "7.5.1",
3
+ "version": "7.6.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",