@dhyasama/totem-models 8.78.0 → 8.80.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.
Files changed (2) hide show
  1. package/lib/Organization.js +150 -311
  2. package/package.json +1 -1
@@ -193,6 +193,15 @@ module.exports = function(mongoose, config) {
193
193
  active: { type: Boolean, default: false }
194
194
  },
195
195
 
196
+ sheet: {
197
+ id: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
198
+ format: {
199
+ transformRounds: { type: Boolean, default: false },
200
+ transformUnrealized: { type: Boolean, default: false },
201
+ transformRealized: { type: Boolean, default: false }
202
+ }
203
+ },
204
+
196
205
  portfolio: {
197
206
 
198
207
  reports: [{
@@ -215,71 +224,75 @@ module.exports = function(mongoose, config) {
215
224
  width: { type: Number, default: 150 }
216
225
  }],
217
226
  view: { type: String, trim: true }
218
- }],
227
+ }]
219
228
 
220
- financials: {
221
- active: { type: Boolean, default: false },
222
- managedServices: { type: Boolean, default: false },
223
- reminders: { type: [Number], default: [7, 7, 7] },
229
+ },
224
230
 
225
- messages: [{
226
- _id: false,
227
- name: { type: String, trim: true },
228
- html: { type: String, trim: true }
229
- }],
230
- templates: [{
231
- _id: false,
232
- name: { type: String, trim: true },
233
- form: [{
234
- _id: false,
235
- name: { type: String, trim: true },
236
- type: { type: String, enum: [null, 'block', 'document', 'metric', 'question']}
237
- }]
238
- }],
239
- documents: [{
240
- _id: false,
241
- name: { type: String, trim: true },
242
- description: { type: String, trim: true },
243
- required: { type: Boolean, default: false }
244
- }],
245
- metrics: [{
246
- _id: false,
247
- name: { type: String, trim: true },
248
- description: { type: String, trim: true },
249
- format: { type: String, enum: [null, 'number', 'money', 'percentage', 'variance']},
250
- required: { type: Boolean, default: false }
251
- }],
252
- questions: [{
253
- _id: false,
254
- prompt: { type: String, trim: true },
255
- required: { type: Boolean, default: false }
256
- }]
257
- },
231
+ financials: {
258
232
 
259
- irr: {
260
- active: { type: Boolean, default: false },
261
- },
233
+ active: { type: Boolean, default: false },
234
+
235
+ managedServices: { type: Boolean, default: false },
236
+ reminders: { type: [Number], default: [7, 7, 7] },
262
237
 
263
238
  carta: {
264
- active: { type: Boolean, default: false },
265
- firmid: { type: String, unique: true, partialFilterExpression : { type :"string" }, trim: true }
239
+ active: { type: Boolean, default: false }
266
240
  },
267
241
 
268
- investmentsSheet: {
269
- sheet: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
270
- format: {
271
- transformRounds: { type: Boolean, default: false },
272
- transformUnrealized: { type: Boolean, default: false },
273
- transformRealized: { type: Boolean, default: false }
242
+ messages: [{
243
+ _id: false,
244
+ name: { type: String, trim: true },
245
+ html: { type: String, trim: true }
246
+ }],
247
+ templates: [{
248
+ _id: false,
249
+ name: { type: String, trim: true },
250
+ form: [{
251
+ _id: false,
252
+ name: { type: String, trim: true },
253
+ type: { type: String, enum: [null, 'block', 'document', 'metric', 'question']}
254
+ }]
255
+ }],
256
+ documents: [{
257
+ _id: false,
258
+ name: { type: String, trim: true },
259
+ description: { type: String, trim: true },
260
+ required: { type: Boolean, default: false }
261
+ }],
262
+ metrics: [{
263
+ _id: false,
264
+ name: { type: String, trim: true },
265
+ description: { type: String, trim: true },
266
+ format: { type: String, enum: [null, 'number', 'money', 'percentage', 'variance']},
267
+ required: { type: Boolean, default: false }
268
+ }],
269
+ questions: [{
270
+ _id: false,
271
+ prompt: { type: String, trim: true },
272
+ required: { type: Boolean, default: false }
273
+ }],
274
+
275
+ reports: [{
276
+ name: { type: String, trim: true },
277
+ filters: [{
278
+ _id: false,
279
+ key: { type: String, trim: true },
280
+ condition: { type: String, enum: [null, 'equals', 'doesNotEqual', 'contains', 'doesNotContain', 'lessThan', 'greaterThan']},
281
+ values: [{ type: String, trim: true }]
282
+ }],
283
+ sort: {
284
+ by: { type: String, trim: true },
285
+ reverse: { type: Boolean, default: false }
274
286
  },
275
- googleSheetCreds: {
276
- private_key_id: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
277
- private_key: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
278
- client_email: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
279
- client_id: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
280
- type: { type: String, trim: true }
281
- }
282
- }
287
+ fields: [{
288
+ _id: false,
289
+ key: { type: String, trim: true },
290
+ label: { type: String, trim: true },
291
+ total: { type: String, enum: [null, 'sum', 'average', 'count', 'multiple']},
292
+ width: { type: Number, default: 150 }
293
+ }],
294
+ view: { type: String, trim: true }
295
+ }]
283
296
 
284
297
  },
285
298
 
@@ -295,84 +308,8 @@ module.exports = function(mongoose, config) {
295
308
  }],
296
309
 
297
310
  sourceTypes: { type: Array, default: ['Cold Inbound', 'Cold Outbound', 'Met at Event', 'Was Referred', 'Other'] },
298
-
299
311
  referrerTypes: { type: Array, default: ['Founder', 'Investor', 'Service Provider', 'Friends & Family', 'Limited Partner', 'Other'] },
300
312
 
301
- standardFields: {
302
-
303
- // Standard fields are always "on" in the system
304
- // They can be configured in how they work on the deal list page
305
- // order for standard fields only sets the order on the list page. their position is fixed on the org page deal section and edit form.
306
- // order is co-mingled with order for custom fields
307
- // colspan is for the number of columns the field should take up on the list page
308
- // showOnFilter controls whether values are extracted and used in filtering options on list page
309
- // showOnList controls if the field will be on deal list page
310
-
311
- action: {
312
- order: { type: Number, default: 99 },
313
- colspan: { type: Number, default: 1 },
314
- showOnFilter: { type: Boolean, default: true },
315
- showOnList: { type: Boolean, default: true }
316
- },
317
-
318
- raise: {
319
- order: { type: Number, default: 99 },
320
- colspan: { type: Number, default: 1 },
321
- showOnFilter: { type: Boolean, default: true },
322
- showOnList: { type: Boolean, default: true }
323
- },
324
-
325
- valuation: {
326
- order: { type: Number, default: 99 },
327
- colspan: { type: Number, default: 1 },
328
- showOnFilter: { type: Boolean, default: true },
329
- showOnList: { type: Boolean, default: true }
330
- },
331
-
332
- sourcePerson: {
333
- order: { type: Number, default: 99 },
334
- colspan: { type: Number, default: 1 },
335
- showOnFilter: { type: Boolean, default: true },
336
- showOnList: { type: Boolean, default: true }
337
- },
338
-
339
- sourceType: {
340
- order: { type: Number, default: 99 },
341
- colspan: { type: Number, default: 1 },
342
- showOnFilter: { type: Boolean, default: true },
343
- showOnList: { type: Boolean, default: true }
344
- },
345
-
346
- referrerPerson: {
347
- order: { type: Number, default: 99 },
348
- colspan: { type: Number, default: 1 },
349
- showOnFilter: { type: Boolean, default: true },
350
- showOnList: { type: Boolean, default: true }
351
- },
352
-
353
- referrerType: {
354
- order: { type: Number, default: 99 },
355
- colspan: { type: Number, default: 1 },
356
- showOnFilter: { type: Boolean, default: true },
357
- showOnList: { type: Boolean, default: true }
358
- },
359
-
360
- chairs: {
361
- order: { type: Number, default: 99 },
362
- colspan: { type: Number, default: 1 },
363
- showOnFilter: { type: Boolean, default: true },
364
- showOnList: { type: Boolean, default: true }
365
- },
366
-
367
- location: {
368
- order: { type: Number, default: 99 },
369
- colspan: { type: Number, default: 1 },
370
- showOnFilter: { type: Boolean, default: true },
371
- showOnList: { type: Boolean, default: true }
372
- }
373
-
374
- },
375
-
376
313
  customFields: [{
377
314
 
378
315
  // Data stored on deals will be accessed with this key
@@ -422,19 +359,97 @@ module.exports = function(mongoose, config) {
422
359
 
423
360
  }
424
361
 
362
+ }],
363
+
364
+ reports: [{
365
+ name: { type: String, trim: true },
366
+ filters: [{
367
+ _id: false,
368
+ key: { type: String, trim: true },
369
+ condition: { type: String, enum: [null, 'equals', 'doesNotEqual', 'contains', 'doesNotContain', 'lessThan', 'greaterThan']},
370
+ values: [{ type: String, trim: true }]
371
+ }],
372
+ sort: {
373
+ by: { type: String, trim: true },
374
+ reverse: { type: Boolean, default: false }
375
+ },
376
+ fields: [{
377
+ _id: false,
378
+ key: { type: String, trim: true },
379
+ label: { type: String, trim: true },
380
+ total: { type: String, enum: [null, 'sum', 'average', 'count', 'multiple']},
381
+ width: { type: Number, default: 150 }
382
+ }],
383
+ view: { type: String, trim: true }
384
+ }]
385
+
386
+ },
387
+
388
+ funds: {
389
+
390
+ irr: {
391
+ active: { type: Boolean, default: false },
392
+ },
393
+
394
+ reports: [{
395
+ name: { type: String, trim: true },
396
+ filters: [{
397
+ _id: false,
398
+ key: { type: String, trim: true },
399
+ condition: { type: String, enum: [null, 'equals', 'doesNotEqual', 'contains', 'doesNotContain', 'lessThan', 'greaterThan']},
400
+ values: [{ type: String, trim: true }]
401
+ }],
402
+ sort: {
403
+ by: { type: String, trim: true },
404
+ reverse: { type: Boolean, default: false }
405
+ },
406
+ fields: [{
407
+ _id: false,
408
+ key: { type: String, trim: true },
409
+ label: { type: String, trim: true },
410
+ total: { type: String, enum: [null, 'sum', 'average', 'count', 'multiple']},
411
+ width: { type: Number, default: 150 }
412
+ }],
413
+ view: { type: String, trim: true }
425
414
  }]
426
415
 
427
416
  },
428
417
 
429
418
  lps: {
430
419
 
431
- active: {type: Boolean, default: false},
420
+ active: { type: Boolean, default: false },
421
+
422
+ irr: {
423
+ active: { type: Boolean, default: false },
424
+ },
425
+
426
+ reports: [{
427
+ name: { type: String, trim: true },
428
+ filters: [{
429
+ _id: false,
430
+ key: { type: String, trim: true },
431
+ condition: { type: String, enum: [null, 'equals', 'doesNotEqual', 'contains', 'doesNotContain', 'lessThan', 'greaterThan']},
432
+ values: [{ type: String, trim: true }]
433
+ }],
434
+ sort: {
435
+ by: { type: String, trim: true },
436
+ reverse: { type: Boolean, default: false }
437
+ },
438
+ fields: [{
439
+ _id: false,
440
+ key: { type: String, trim: true },
441
+ label: { type: String, trim: true },
442
+ total: { type: String, enum: [null, 'sum', 'average', 'count', 'multiple']},
443
+ width: { type: Number, default: 150 }
444
+ }],
445
+ view: { type: String, trim: true }
446
+ }]
432
447
 
433
448
  },
434
449
 
435
450
  lists: {
436
451
 
437
- active: {type: Boolean, default: false},
452
+ active: { type: Boolean, default: false },
438
453
 
439
454
  }
440
455
 
@@ -451,22 +466,9 @@ module.exports = function(mongoose, config) {
451
466
  // Another way to put it, these are funds from which this organization makes investments
452
467
  funds: [{ type: Schema.ObjectId, ref: 'Fund' }],
453
468
 
454
- financials: [{
455
-
456
- customer: { type: Schema.ObjectId, ref: 'Organization' },
457
-
458
- // ok to send emails to collect financials
459
- allowed: { type: Boolean, default: true },
460
-
461
- // email to send link to
462
- email: { type: String, trim: true }
463
-
464
- }]
465
-
466
469
  });
467
470
 
468
471
 
469
-
470
472
  ///////////////////////////////////////////////////////////////////////////////////////
471
473
  // VIRTUALS
472
474
  // Properties that are not persisted to the database
@@ -600,169 +602,6 @@ module.exports = function(mongoose, config) {
600
602
 
601
603
  });
602
604
 
603
- Organization.virtual('customer.deals.fields').get(function () {
604
-
605
- // Combine standard fields and custom fields into a single list and sort by column order
606
- // Fundraise is actually two fields, so multiply the order by ten to make room for the extra field
607
-
608
- var self = this;
609
-
610
- var standardFields = self.customer.deals.standardFields;
611
-
612
- // Defaulting to off so it will be immediately apparent the customer hasn't been properly configured
613
- standardFields = standardFields || {
614
- fundraise: {
615
- showOnList: false
616
- },
617
- sources: {
618
- showOnList: false
619
- },
620
- referrers: {
621
- showOnList: false
622
- }
623
- };
624
-
625
- var customFields = self.customer.deals.customFields;
626
- var result = [];
627
-
628
- // Add standard fields
629
- if (standardFields.action.showOnList) {
630
- result.push({
631
- name: 'Next Steps',
632
- type: 'Text',
633
- key: 'action',
634
- isStandard: true,
635
- order: standardFields.action.order * 10,
636
- colspan: standardFields.action.colspan || 1,
637
- showOnFilter: standardFields.action.showOnFilter === true ? true : false
638
- });
639
- }
640
-
641
- if (standardFields.raise.showOnList) {
642
- result.push({
643
- name: 'Raise',
644
- type: 'Money',
645
- key: 'fundraise.amount',
646
- isStandard: true,
647
- order: standardFields.raise.order * 10,
648
- colspan: standardFields.raise.colspan || 1,
649
- showOnFilter: standardFields.raise.showOnFilter === true ? true : false
650
- });
651
- }
652
-
653
- if(standardFields.valuation.showOnList) {
654
- result.push({
655
- name: 'Valuation',
656
- type: 'Money',
657
- key: 'fundraise.valuation',
658
- isStandard: true,
659
- order: standardFields.valuation.order * 10 + 1,
660
- colspan: standardFields.valuation.colspan || 1,
661
- showOnFilter: standardFields.valuation.showOnFilter === true ? true : false
662
- });
663
- }
664
-
665
- if (standardFields.sourcePerson.showOnList) {
666
- result.push({
667
- name: 'Source',
668
- type: 'Reference',
669
- key: 'source.person',
670
- isStandard: true,
671
- order: standardFields.sourcePerson.order * 10,
672
- colspan: standardFields.sourcePerson.colspan || 1,
673
- showOnFilter: standardFields.sourcePerson.showOnFilter === true ? true : false
674
- });
675
- }
676
-
677
- if (standardFields.sourceType.showOnList) {
678
- result.push({
679
- name: 'Source Type',
680
- type: 'Single Select',
681
- key: 'source.type',
682
- isStandard: true,
683
- order: standardFields.sourceType.order * 10,
684
- colspan: standardFields.sourceType.colspan || 1,
685
- showOnFilter: standardFields.sourceType.showOnFilter === true ? true : false
686
- });
687
- }
688
-
689
- if (standardFields.referrerPerson.showOnList) {
690
- result.push({
691
- name: 'Referrer',
692
- type: 'Reference',
693
- key: 'referrer.person',
694
- isStandard: true,
695
- order: standardFields.referrerPerson.order * 10,
696
- colspan: standardFields.referrerPerson.colspan || 1,
697
- showOnFilter: standardFields.referrerPerson.showOnFilter === true ? true : false
698
- });
699
- }
700
-
701
- if (standardFields.referrerType.showOnList) {
702
- result.push({
703
- name: 'Referrer Type',
704
- type: 'Single Select',
705
- key: 'referrer.type',
706
- isStandard: true,
707
- order: standardFields.referrerType.order * 10,
708
- colspan: standardFields.referrerType.colspan || 1,
709
- showOnFilter: standardFields.referrerType.showOnFilter === true ? true : false
710
- });
711
- }
712
-
713
- if (standardFields.chairs.showOnList) {
714
- result.push({
715
- name: 'Leads',
716
- type: 'Reference',
717
- key: 'organization.chairs',
718
- isStandard: true,
719
- order: standardFields.chairs.order * 10,
720
- colspan: standardFields.chairs.colspan || 1,
721
- showOnFilter: standardFields.chairs.showOnFilter === true ? true : false
722
- });
723
- }
724
-
725
- if (standardFields.location.showOnList) {
726
- result.push({
727
- name: 'Location',
728
- type: 'Location',
729
- key: 'organization.contact.address',
730
- isStandard: true,
731
- order: standardFields.location.order * 10,
732
- colspan: standardFields.location.colspan || 1,
733
- showOnFilter: standardFields.location.showOnFilter === true ? true : false
734
- });
735
- }
736
-
737
- // Add custom fields
738
- _.each(customFields, function(field) {
739
- if (field.display.showOnList) {
740
- result.push({
741
- name: field.label,
742
- type: field.type,
743
- isStandard: false,
744
- key: field.key,
745
- options: field.options,
746
- order: field.display.order * 10,
747
- colspan: field.display.colspan || 1,
748
- showOnFilter: field.display.showOnFilter === true ? true : false
749
- });
750
- }
751
- });
752
-
753
- // Sort the combined standard and custom fields
754
- result = _.sortBy(result, function(item) { return item.order; });
755
-
756
- // Now that we have all fields combined and ordered, make column order zero-indexed and gap-free
757
- result = _.map(result, function(item, index) {
758
- item.order = index;
759
- return item;
760
- });
761
-
762
- return result;
763
-
764
- });
765
-
766
605
  Organization.virtual('employees.all').get(function () {
767
606
 
768
607
  var self = this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "8.78.0",
3
+ "version": "8.80.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",