@dhyasama/totem-models 8.104.0 → 8.105.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 +37 -7
- package/package.json +1 -1
package/lib/CapTable.js
CHANGED
|
@@ -50,6 +50,21 @@ 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
|
|
54
|
+
fund: {
|
|
55
|
+
type: Schema.ObjectId,
|
|
56
|
+
ref: 'Fund',
|
|
57
|
+
default: null,
|
|
58
|
+
required: false,
|
|
59
|
+
validate: {
|
|
60
|
+
validator: function(v) {
|
|
61
|
+
if (v && this.person || this.org || this.lp) return false;
|
|
62
|
+
else return true;
|
|
63
|
+
},
|
|
64
|
+
message: 'A stakeholder can only be linked to one of the following: fund, person, org, lp'
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
|
|
53
68
|
// link stakeholder to a person in our system
|
|
54
69
|
person: {
|
|
55
70
|
type: Schema.ObjectId,
|
|
@@ -58,25 +73,40 @@ module.exports = function(mongoose, config) {
|
|
|
58
73
|
required: false,
|
|
59
74
|
validate: {
|
|
60
75
|
validator: function(v) {
|
|
61
|
-
if (v && this.fund) return false;
|
|
76
|
+
if (v && this.fund || this.org || this.lp) return false;
|
|
62
77
|
else return true;
|
|
63
78
|
},
|
|
64
|
-
message: 'A stakeholder can be linked to
|
|
79
|
+
message: 'A stakeholder can only be linked to one of the following: fund, person, org, lp'
|
|
65
80
|
}
|
|
66
81
|
},
|
|
67
82
|
|
|
68
|
-
// link stakeholder to a
|
|
69
|
-
|
|
83
|
+
// link stakeholder to a person in our system
|
|
84
|
+
org: {
|
|
70
85
|
type: Schema.ObjectId,
|
|
71
|
-
ref: '
|
|
86
|
+
ref: 'Organization',
|
|
87
|
+
default: null,
|
|
88
|
+
required: false,
|
|
89
|
+
validate: {
|
|
90
|
+
validator: function(v) {
|
|
91
|
+
if (v || this.fund || this.person || this.lp) return false;
|
|
92
|
+
else return true;
|
|
93
|
+
},
|
|
94
|
+
message: 'A stakeholder can only be linked to one of the following: fund, person, org, lp'
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
// link stakeholder to a lp in our system
|
|
99
|
+
lp: {
|
|
100
|
+
type: Schema.ObjectId,
|
|
101
|
+
ref: 'LimitedPartner',
|
|
72
102
|
default: null,
|
|
73
103
|
required: false,
|
|
74
104
|
validate: {
|
|
75
105
|
validator: function(v) {
|
|
76
|
-
if (v
|
|
106
|
+
if (v || this.fund || this.person || this.org) return false;
|
|
77
107
|
else return true;
|
|
78
108
|
},
|
|
79
|
-
message: 'A stakeholder can be linked to
|
|
109
|
+
message: 'A stakeholder can only be linked to one of the following: fund, person, org, lp'
|
|
80
110
|
}
|
|
81
111
|
},
|
|
82
112
|
|