@dhyasama/totem-models 8.105.0 → 8.107.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/CapTable.js CHANGED
@@ -50,7 +50,7 @@ module.exports = function(mongoose, config) {
50
50
  // verbatim text from the cap table
51
51
  name: { type: String, trim: true, required: true },
52
52
 
53
- // link to a fund in our system
53
+ // link stakeholder to a fund in our system
54
54
  fund: {
55
55
  type: Schema.ObjectId,
56
56
  ref: 'Fund',
@@ -58,25 +58,25 @@ module.exports = function(mongoose, config) {
58
58
  required: false,
59
59
  validate: {
60
60
  validator: function(v) {
61
- if (v && this.person || this.org || this.lp) return false;
61
+ if (v && this.lp || this.org || this.person) return false;
62
62
  else return true;
63
63
  },
64
- message: 'A stakeholder can only be linked to one of the following: fund, person, org, lp'
64
+ message: 'A stakeholder can only be linked to one of the following: fund, lp, org, person'
65
65
  }
66
66
  },
67
67
 
68
- // link stakeholder to a person in our system
69
- person: {
68
+ // link stakeholder to a lp in our system
69
+ lp: {
70
70
  type: Schema.ObjectId,
71
- ref: 'Person',
71
+ ref: 'LimitedPartner',
72
72
  default: null,
73
73
  required: false,
74
74
  validate: {
75
75
  validator: function(v) {
76
- if (v && this.fund || this.org || this.lp) return false;
76
+ if (v || this.fund || this.org || this.person) return false;
77
77
  else return true;
78
78
  },
79
- message: 'A stakeholder can only be linked to one of the following: fund, person, org, lp'
79
+ message: 'A stakeholder can only be linked to one of the following: fund, lp, org, person'
80
80
  }
81
81
  },
82
82
 
@@ -88,25 +88,25 @@ module.exports = function(mongoose, config) {
88
88
  required: false,
89
89
  validate: {
90
90
  validator: function(v) {
91
- if (v || this.fund || this.person || this.lp) return false;
91
+ if (v || this.fund || this.lp || this.person) return false;
92
92
  else return true;
93
93
  },
94
- message: 'A stakeholder can only be linked to one of the following: fund, person, org, lp'
94
+ message: 'A stakeholder can only be linked to one of the following: fund, lp, org, person'
95
95
  }
96
96
  },
97
97
 
98
- // link stakeholder to a lp in our system
99
- lp: {
98
+ // link stakeholder to a person in our system
99
+ person: {
100
100
  type: Schema.ObjectId,
101
- ref: 'LimitedPartner',
101
+ ref: 'Person',
102
102
  default: null,
103
103
  required: false,
104
104
  validate: {
105
105
  validator: function(v) {
106
- if (v || this.fund || this.person || this.org) return false;
106
+ if (v && this.fund || this.lp || this.org) return false;
107
107
  else return true;
108
108
  },
109
- message: 'A stakeholder can only be linked to one of the following: fund, person, org, lp'
109
+ message: 'A stakeholder can only be linked to one of the following: fund, lp, org, person'
110
110
  }
111
111
  },
112
112
 
@@ -492,6 +492,4 @@ module.exports = function(mongoose, config) {
492
492
 
493
493
  mongoose.model('CapTable', CapTable);
494
494
 
495
- };
496
-
497
-
495
+ };
package/lib/Fund.js CHANGED
@@ -21,7 +21,11 @@ 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
+ customFields: { type: Schema.Types.Mixed },
25
+
26
+ // the stakeholders names we match to on cap tables
27
+ stakeholders: [{ type: String, unique: true, partialFilterExpression : { type :"string" }, trim: true, lowercase: true }]
28
+
25
29
  });
26
30
 
27
31
  /************* BASIC FIELDS **********************/
@@ -104,7 +104,10 @@ module.exports = function(mongoose, config) {
104
104
  customFields: { type: Schema.Types.Mixed },
105
105
 
106
106
  // customer specific (customer id is stored on doc)
107
- documents: [ { type: Schema.ObjectId, ref: 'Document' } ]
107
+ documents: [ { type: Schema.ObjectId, ref: 'Document' } ],
108
+
109
+ // the stakeholders names we match to on cap tables
110
+ stakeholders: [{ type: String, unique: true, partialFilterExpression : { type :"string" }, trim: true, lowercase: true }]
108
111
 
109
112
  });
110
113
 
@@ -586,7 +586,10 @@ module.exports = function(mongoose, config) {
586
586
  _id: false,
587
587
  customer: { type: Schema.ObjectId, ref: 'Organization' },
588
588
  fields: { type: Schema.Types.Mixed }
589
- }]
589
+ }],
590
+
591
+ // the stakeholders names we match to on cap tables
592
+ stakeholders: [{ type: String, unique: true, partialFilterExpression : { type :"string" }, trim: true, lowercase: true }]
590
593
 
591
594
  });
592
595
 
package/lib/Person.js CHANGED
@@ -131,7 +131,10 @@ module.exports = function(mongoose, config) {
131
131
 
132
132
  related: [{ type: Schema.ObjectId, ref: 'Person' }],
133
133
 
134
- doNotDisplay: { type: Boolean, default: false }
134
+ doNotDisplay: { type: Boolean, default: false },
135
+
136
+ // the stakeholders names we match to on cap tables
137
+ stakeholders: [{ type: String, unique: true, partialFilterExpression : { type :"string" }, trim: true, lowercase: true }]
135
138
 
136
139
  });
137
140
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "8.105.0",
3
+ "version": "8.107.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",