@dhyasama/totem-models 10.66.1 → 10.67.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 +1 -19
- package/lib/Organization.js +8 -29
- package/package.json +1 -1
package/lib/Financials.js
CHANGED
|
@@ -289,24 +289,12 @@ module.exports = function(mongoose, config) {
|
|
|
289
289
|
const self = this;
|
|
290
290
|
const session = mongoose.startSession();
|
|
291
291
|
|
|
292
|
-
console.log('Upserting metrics for financials', financialsId)
|
|
293
|
-
console.log('Upserting metrics for snapshot', snapshotUUID)
|
|
294
|
-
console.log('Metrics to upsert:', metricsToUpdate)
|
|
295
|
-
|
|
296
292
|
session.then(_session => {
|
|
297
293
|
|
|
298
294
|
_session.startTransaction();
|
|
299
295
|
|
|
300
|
-
console.log('started session');
|
|
301
|
-
|
|
302
296
|
const promises = metricsToUpdate.map(metric => {
|
|
303
297
|
|
|
304
|
-
console.log('Upserting metric:', metric);
|
|
305
|
-
console.log('Upserting metric name:', metric.name);
|
|
306
|
-
console.log('Upserting metric actual:', metric.actual);
|
|
307
|
-
console.log('Upserting metric budget:', metric.budget);
|
|
308
|
-
console.log('Upserting metric breakdown:', metric.breakdown);
|
|
309
|
-
|
|
310
298
|
// Check if the metric exists and update it
|
|
311
299
|
return self.findOneAndUpdate(
|
|
312
300
|
{
|
|
@@ -328,19 +316,13 @@ module.exports = function(mongoose, config) {
|
|
|
328
316
|
}
|
|
329
317
|
).then(result => {
|
|
330
318
|
|
|
331
|
-
console.log('Upsert result:', result)
|
|
332
|
-
|
|
333
319
|
if (!result) {
|
|
334
|
-
console.log('Metric not found')
|
|
335
320
|
// If the metric doesn't exist, push it to the array
|
|
336
321
|
return self.findOneAndUpdate(
|
|
337
322
|
{ _id: financialsId, 'snapshots.uuid': snapshotUUID },
|
|
338
323
|
{ $push: { 'snapshots.$.metrics': metric } },
|
|
339
324
|
{ new: true, session: _session }
|
|
340
|
-
)
|
|
341
|
-
console.log('Result of second findOneAndUpdate:', result);
|
|
342
|
-
return result;
|
|
343
|
-
});
|
|
325
|
+
);
|
|
344
326
|
}
|
|
345
327
|
|
|
346
328
|
return result;
|
package/lib/Organization.js
CHANGED
|
@@ -223,6 +223,10 @@ module.exports = function(mongoose, config) {
|
|
|
223
223
|
active: { type: Boolean, default: false }
|
|
224
224
|
},
|
|
225
225
|
|
|
226
|
+
carta: {
|
|
227
|
+
active: { type: Boolean, default: false }
|
|
228
|
+
},
|
|
229
|
+
|
|
226
230
|
sheet: {
|
|
227
231
|
id: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
|
|
228
232
|
format: {
|
|
@@ -260,10 +264,7 @@ module.exports = function(mongoose, config) {
|
|
|
260
264
|
// This is used to aggregate answers for polls
|
|
261
265
|
type: { type: String, enum: ['String', 'Number', 'Boolean'] }
|
|
262
266
|
|
|
263
|
-
}]
|
|
264
|
-
|
|
265
|
-
// Determines whether the field should be pinned to the entity page
|
|
266
|
-
pin: { type: Boolean, default: false }
|
|
267
|
+
}]
|
|
267
268
|
|
|
268
269
|
}],
|
|
269
270
|
|
|
@@ -299,14 +300,9 @@ module.exports = function(mongoose, config) {
|
|
|
299
300
|
financials: {
|
|
300
301
|
|
|
301
302
|
active: { type: Boolean, default: false },
|
|
302
|
-
managedServices: { type: Boolean, default: false },
|
|
303
303
|
|
|
304
304
|
shared: [{ type: Schema.ObjectId, ref: 'Financials' }],
|
|
305
305
|
|
|
306
|
-
carta: {
|
|
307
|
-
active: { type: Boolean, default: false }
|
|
308
|
-
},
|
|
309
|
-
|
|
310
306
|
display: {
|
|
311
307
|
timeframe: { type: String, enum: ['All Years', 'Last 12 Months'], default: 'All Years' },
|
|
312
308
|
group: { type: String, enum: ['Financial Statements', 'Template'], default: 'Financial Statements' }
|
|
@@ -436,10 +432,7 @@ module.exports = function(mongoose, config) {
|
|
|
436
432
|
// This is used to aggregate answers for polls
|
|
437
433
|
type: { type: String, enum: ['String', 'Number', 'Boolean'] }
|
|
438
434
|
|
|
439
|
-
}]
|
|
440
|
-
|
|
441
|
-
// Determines whether the field should be pinned to the entity page
|
|
442
|
-
pin: { type: Boolean, default: false }
|
|
435
|
+
}]
|
|
443
436
|
|
|
444
437
|
}],
|
|
445
438
|
|
|
@@ -474,10 +467,6 @@ module.exports = function(mongoose, config) {
|
|
|
474
467
|
|
|
475
468
|
funds: {
|
|
476
469
|
|
|
477
|
-
irr: {
|
|
478
|
-
active: { type: Boolean, default: false },
|
|
479
|
-
},
|
|
480
|
-
|
|
481
470
|
customFields: [{
|
|
482
471
|
|
|
483
472
|
// store the data using this key (changing it after data is in the system will make data inaccessible)
|
|
@@ -504,10 +493,7 @@ module.exports = function(mongoose, config) {
|
|
|
504
493
|
// This is used to aggregate answers for polls
|
|
505
494
|
type: { type: String, enum: ['String', 'Number', 'Boolean'] }
|
|
506
495
|
|
|
507
|
-
}]
|
|
508
|
-
|
|
509
|
-
// Determines whether the field should be pinned to the entity page
|
|
510
|
-
pin: { type: Boolean, default: false }
|
|
496
|
+
}]
|
|
511
497
|
|
|
512
498
|
}],
|
|
513
499
|
|
|
@@ -544,10 +530,6 @@ module.exports = function(mongoose, config) {
|
|
|
544
530
|
|
|
545
531
|
active: { type: Boolean, default: false },
|
|
546
532
|
|
|
547
|
-
irr: {
|
|
548
|
-
active: { type: Boolean, default: false },
|
|
549
|
-
},
|
|
550
|
-
|
|
551
533
|
customFields: [{
|
|
552
534
|
|
|
553
535
|
// store the data using this key (changing it after data is in the system will make data inaccessible)
|
|
@@ -574,10 +556,7 @@ module.exports = function(mongoose, config) {
|
|
|
574
556
|
// This is used to aggregate answers for polls
|
|
575
557
|
type: { type: String, enum: ['String', 'Number', 'Boolean'] }
|
|
576
558
|
|
|
577
|
-
}]
|
|
578
|
-
|
|
579
|
-
// Determines whether the field should be pinned to the entity page
|
|
580
|
-
pin: { type: Boolean, default: false }
|
|
559
|
+
}]
|
|
581
560
|
|
|
582
561
|
}],
|
|
583
562
|
|