@dhyasama/totem-models 8.82.1 → 8.84.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/helpers.js +3 -3
- package/lib/Fund.js +4 -0
- package/lib/LimitedPartner.js +4 -1
- package/lib/Organization.js +147 -8
- package/package.json +1 -1
package/helpers.js
CHANGED
|
@@ -16,11 +16,11 @@ const cleanOrg = module.exports.cleanOrg = function cleanOrg(doc, customerId) {
|
|
|
16
16
|
// remove customer details if not viewing self
|
|
17
17
|
if (doc._id.toString() !== customerId.toString()) { doc.customer = {}; }
|
|
18
18
|
|
|
19
|
-
doc.
|
|
19
|
+
doc.chairs = _.reject(doc.chairs, function(item) { return !item.customer || item.customer.toString() !== customerId.toString(); });
|
|
20
|
+
doc.customFields = _.reject(doc.customFields, function(item) { return !item.customer || item.customer.toString() !== customerId.toString(); });
|
|
20
21
|
doc.filters = _.reject(doc.filters, function(item) { return !item.customer || item.customer.toString() !== customerId.toString(); });
|
|
22
|
+
doc.lps = _.reject(doc.lps, function(item) { return !item.customer || item.customer.toString() !== customerId.toString(); });
|
|
21
23
|
doc.valuations = _.reject(doc.valuations, function(item) { return !item.customer || item.customer.toString() !== customerId.toString(); });
|
|
22
|
-
doc.iLevel = _.reject(doc.iLevel, function(item) { return !item.customer || item.customer.toString() !== customerId.toString(); });
|
|
23
|
-
doc.chairs = _.reject(doc.chairs, function(item) { return !item.customer || item.customer.toString() !== customerId.toString(); });
|
|
24
24
|
doc.operating.acquired.private = _.find(doc.operating.acquired.private, function(item) { return !item.customer || item.customer.toString() === customerId.toString(); });
|
|
25
25
|
doc.operating.closed.private = _.find(doc.operating.closed.private, function(item) { return !item.customer || item.customer.toString() === customerId.toString(); });
|
|
26
26
|
|
package/lib/Fund.js
CHANGED
|
@@ -21,6 +21,7 @@ module.exports = function(mongoose, config) {
|
|
|
21
21
|
amount: { type: Number, default: 0 },
|
|
22
22
|
date: { type: Date, default: null },
|
|
23
23
|
}],
|
|
24
|
+
customFields: { type: Schema.Types.Mixed }
|
|
24
25
|
});
|
|
25
26
|
|
|
26
27
|
/************* BASIC FIELDS **********************/
|
|
@@ -131,6 +132,9 @@ module.exports = function(mongoose, config) {
|
|
|
131
132
|
if (!fund) { return cb(new Error('Fund is required'), null); }
|
|
132
133
|
if (!username) { return cb(new Error('Username is required'), null); }
|
|
133
134
|
|
|
135
|
+
// Required for mixed types
|
|
136
|
+
fund.markModified('customFields');
|
|
137
|
+
|
|
134
138
|
fund.save(cb);
|
|
135
139
|
|
|
136
140
|
};
|
package/lib/LimitedPartner.js
CHANGED
|
@@ -99,7 +99,9 @@ module.exports = function(mongoose, config) {
|
|
|
99
99
|
value: { type: Schema.Types.Mixed, required: true },
|
|
100
100
|
format: { type: String, enum: [null, 'number', 'decimal', 'money', 'percentage', 'date']},
|
|
101
101
|
_id: false
|
|
102
|
-
}]
|
|
102
|
+
}],
|
|
103
|
+
|
|
104
|
+
customFields: { type: Schema.Types.Mixed }
|
|
103
105
|
|
|
104
106
|
});
|
|
105
107
|
|
|
@@ -726,6 +728,7 @@ module.exports = function(mongoose, config) {
|
|
|
726
728
|
|
|
727
729
|
// Required for mixed types
|
|
728
730
|
lp.markModified('details');
|
|
731
|
+
lp.markModified('customFields');
|
|
729
732
|
|
|
730
733
|
lp.extendWithWriteFilter(lp, options.role);
|
|
731
734
|
lp.save(function(err, result) {
|
package/lib/Organization.js
CHANGED
|
@@ -204,6 +204,39 @@ module.exports = function(mongoose, config) {
|
|
|
204
204
|
|
|
205
205
|
portfolio: {
|
|
206
206
|
|
|
207
|
+
customFields: [{
|
|
208
|
+
|
|
209
|
+
// store the data using this key (changing it after data is in the system will make data inaccessible)
|
|
210
|
+
key: { type: String, trim: true },
|
|
211
|
+
|
|
212
|
+
// User friendly text, will be displayed
|
|
213
|
+
label: { type: String, trim: true },
|
|
214
|
+
|
|
215
|
+
// Dictates the type of control rendered on form and data validation
|
|
216
|
+
type: { type: String, enum: ['Text', 'Number', 'Checkbox', 'Single Select', 'Timestamp', 'Tags', 'Person', 'Org', 'Poll'] },
|
|
217
|
+
|
|
218
|
+
// These are the number formats
|
|
219
|
+
format: { type: String, enum: ['number', 'abbreviated', 'decimal', 'financials', 'currency', 'ownership', 'multiple', 'variance'] },
|
|
220
|
+
|
|
221
|
+
// These will be the choices in polls, single-selects and multi-selects
|
|
222
|
+
options: [{
|
|
223
|
+
|
|
224
|
+
// This is the option shown to users
|
|
225
|
+
label: { type: String, trim: true },
|
|
226
|
+
|
|
227
|
+
// This is the value that gets stored
|
|
228
|
+
value: { type: String, trim: true },
|
|
229
|
+
|
|
230
|
+
// This is used to aggregate answers for polls
|
|
231
|
+
type: { type: String, enum: ['String', 'Number', 'Boolean'] }
|
|
232
|
+
|
|
233
|
+
}],
|
|
234
|
+
|
|
235
|
+
// Determines whether the field should be pinned to the entity page
|
|
236
|
+
pin: { type: Boolean, default: false }
|
|
237
|
+
|
|
238
|
+
}],
|
|
239
|
+
|
|
207
240
|
reports: [{
|
|
208
241
|
name: { type: String, trim: true },
|
|
209
242
|
filters: [{
|
|
@@ -272,6 +305,39 @@ module.exports = function(mongoose, config) {
|
|
|
272
305
|
required: { type: Boolean, default: false }
|
|
273
306
|
}],
|
|
274
307
|
|
|
308
|
+
customFields: [{
|
|
309
|
+
|
|
310
|
+
// store the data using this key (changing it after data is in the system will make data inaccessible)
|
|
311
|
+
key: { type: String, trim: true },
|
|
312
|
+
|
|
313
|
+
// User friendly text, will be displayed
|
|
314
|
+
label: { type: String, trim: true },
|
|
315
|
+
|
|
316
|
+
// Dictates the type of control rendered on form and data validation
|
|
317
|
+
type: { type: String, enum: ['Text', 'Number', 'Checkbox', 'Single Select', 'Timestamp', 'Tags', 'Person', 'Org', 'Poll'] },
|
|
318
|
+
|
|
319
|
+
// These are the number formats
|
|
320
|
+
format: { type: String, enum: ['number', 'abbreviated', 'decimal', 'financials', 'currency', 'ownership', 'multiple', 'variance'] },
|
|
321
|
+
|
|
322
|
+
// These will be the choices in polls, single-selects and multi-selects
|
|
323
|
+
options: [{
|
|
324
|
+
|
|
325
|
+
// This is the option shown to users
|
|
326
|
+
label: { type: String, trim: true },
|
|
327
|
+
|
|
328
|
+
// This is the value that gets stored
|
|
329
|
+
value: { type: String, trim: true },
|
|
330
|
+
|
|
331
|
+
// This is used to aggregate answers for polls
|
|
332
|
+
type: { type: String, enum: ['String', 'Number', 'Boolean'] }
|
|
333
|
+
|
|
334
|
+
}],
|
|
335
|
+
|
|
336
|
+
// Determines whether the field should be pinned to the entity page
|
|
337
|
+
pin: { type: Boolean, default: false }
|
|
338
|
+
|
|
339
|
+
}],
|
|
340
|
+
|
|
275
341
|
reports: [{
|
|
276
342
|
name: { type: String, trim: true },
|
|
277
343
|
filters: [{
|
|
@@ -310,21 +376,16 @@ module.exports = function(mongoose, config) {
|
|
|
310
376
|
|
|
311
377
|
customFields: [{
|
|
312
378
|
|
|
313
|
-
//
|
|
314
|
-
// It must follow standard js variable naming rules
|
|
315
|
-
// Whenever possible, just use the label and replace spaces with underscore
|
|
316
|
-
// Will not be displayed
|
|
317
|
-
// Changing it after data is in the system will make data on deal inaccessible
|
|
379
|
+
// store the data using this key (changing it after data is in the system will make data inaccessible)
|
|
318
380
|
key: { type: String, trim: true },
|
|
319
381
|
|
|
320
382
|
// User friendly text, will be displayed
|
|
321
383
|
label: { type: String, trim: true },
|
|
322
384
|
|
|
323
|
-
// Dictates the type of control rendered on form
|
|
324
|
-
// Also impacts data validation
|
|
385
|
+
// Dictates the type of control rendered on form and data validation
|
|
325
386
|
type: { type: String, enum: ['Text', 'Number', 'Checkbox', 'Single Select', 'Timestamp', 'Tags', 'Person', 'Org', 'Poll'] },
|
|
326
387
|
|
|
327
|
-
//
|
|
388
|
+
// These are the number formats
|
|
328
389
|
format: { type: String, enum: ['number', 'abbreviated', 'decimal', 'financials', 'currency', 'ownership', 'multiple', 'variance'] },
|
|
329
390
|
|
|
330
391
|
// These will be the choices in polls, single-selects and multi-selects
|
|
@@ -341,6 +402,9 @@ module.exports = function(mongoose, config) {
|
|
|
341
402
|
|
|
342
403
|
}],
|
|
343
404
|
|
|
405
|
+
// Determines whether the field should be pinned to the entity page
|
|
406
|
+
pin: { type: Boolean, default: false }
|
|
407
|
+
|
|
344
408
|
}],
|
|
345
409
|
|
|
346
410
|
reports: [{
|
|
@@ -373,6 +437,39 @@ module.exports = function(mongoose, config) {
|
|
|
373
437
|
active: { type: Boolean, default: false },
|
|
374
438
|
},
|
|
375
439
|
|
|
440
|
+
customFields: [{
|
|
441
|
+
|
|
442
|
+
// store the data using this key (changing it after data is in the system will make data inaccessible)
|
|
443
|
+
key: { type: String, trim: true },
|
|
444
|
+
|
|
445
|
+
// User friendly text, will be displayed
|
|
446
|
+
label: { type: String, trim: true },
|
|
447
|
+
|
|
448
|
+
// Dictates the type of control rendered on form and data validation
|
|
449
|
+
type: { type: String, enum: ['Text', 'Number', 'Checkbox', 'Single Select', 'Timestamp', 'Tags', 'Person', 'Org', 'Poll'] },
|
|
450
|
+
|
|
451
|
+
// These are the number formats
|
|
452
|
+
format: { type: String, enum: ['number', 'abbreviated', 'decimal', 'financials', 'currency', 'ownership', 'multiple', 'variance'] },
|
|
453
|
+
|
|
454
|
+
// These will be the choices in polls, single-selects and multi-selects
|
|
455
|
+
options: [{
|
|
456
|
+
|
|
457
|
+
// This is the option shown to users
|
|
458
|
+
label: { type: String, trim: true },
|
|
459
|
+
|
|
460
|
+
// This is the value that gets stored
|
|
461
|
+
value: { type: String, trim: true },
|
|
462
|
+
|
|
463
|
+
// This is used to aggregate answers for polls
|
|
464
|
+
type: { type: String, enum: ['String', 'Number', 'Boolean'] }
|
|
465
|
+
|
|
466
|
+
}],
|
|
467
|
+
|
|
468
|
+
// Determines whether the field should be pinned to the entity page
|
|
469
|
+
pin: { type: Boolean, default: false }
|
|
470
|
+
|
|
471
|
+
}],
|
|
472
|
+
|
|
376
473
|
reports: [{
|
|
377
474
|
name: { type: String, trim: true },
|
|
378
475
|
filters: [{
|
|
@@ -405,6 +502,39 @@ module.exports = function(mongoose, config) {
|
|
|
405
502
|
active: { type: Boolean, default: false },
|
|
406
503
|
},
|
|
407
504
|
|
|
505
|
+
customFields: [{
|
|
506
|
+
|
|
507
|
+
// store the data using this key (changing it after data is in the system will make data inaccessible)
|
|
508
|
+
key: { type: String, trim: true },
|
|
509
|
+
|
|
510
|
+
// User friendly text, will be displayed
|
|
511
|
+
label: { type: String, trim: true },
|
|
512
|
+
|
|
513
|
+
// Dictates the type of control rendered on form and data validation
|
|
514
|
+
type: { type: String, enum: ['Text', 'Number', 'Checkbox', 'Single Select', 'Timestamp', 'Tags', 'Person', 'Org', 'Poll'] },
|
|
515
|
+
|
|
516
|
+
// These are the number formats
|
|
517
|
+
format: { type: String, enum: ['number', 'abbreviated', 'decimal', 'financials', 'currency', 'ownership', 'multiple', 'variance'] },
|
|
518
|
+
|
|
519
|
+
// These will be the choices in polls, single-selects and multi-selects
|
|
520
|
+
options: [{
|
|
521
|
+
|
|
522
|
+
// This is the option shown to users
|
|
523
|
+
label: { type: String, trim: true },
|
|
524
|
+
|
|
525
|
+
// This is the value that gets stored
|
|
526
|
+
value: { type: String, trim: true },
|
|
527
|
+
|
|
528
|
+
// This is used to aggregate answers for polls
|
|
529
|
+
type: { type: String, enum: ['String', 'Number', 'Boolean'] }
|
|
530
|
+
|
|
531
|
+
}],
|
|
532
|
+
|
|
533
|
+
// Determines whether the field should be pinned to the entity page
|
|
534
|
+
pin: { type: Boolean, default: false }
|
|
535
|
+
|
|
536
|
+
}],
|
|
537
|
+
|
|
408
538
|
reports: [{
|
|
409
539
|
name: { type: String, trim: true },
|
|
410
540
|
filters: [{
|
|
@@ -448,6 +578,12 @@ module.exports = function(mongoose, config) {
|
|
|
448
578
|
// Another way to put it, these are funds from which this organization makes investments
|
|
449
579
|
funds: [{ type: Schema.ObjectId, ref: 'Fund' }],
|
|
450
580
|
|
|
581
|
+
customFields: [{
|
|
582
|
+
_id: false,
|
|
583
|
+
customer: { type: Schema.ObjectId, ref: 'Organization' },
|
|
584
|
+
fields: { type: Schema.Types.Mixed }
|
|
585
|
+
}]
|
|
586
|
+
|
|
451
587
|
});
|
|
452
588
|
|
|
453
589
|
|
|
@@ -1714,6 +1850,9 @@ module.exports = function(mongoose, config) {
|
|
|
1714
1850
|
// Clean up missing references
|
|
1715
1851
|
org.people = _.reject(org.people, function(item) { return !item.person; });
|
|
1716
1852
|
|
|
1853
|
+
// Required for mixed types
|
|
1854
|
+
org.markModified('customFields.fields');
|
|
1855
|
+
|
|
1717
1856
|
org.save(cb);
|
|
1718
1857
|
|
|
1719
1858
|
};
|