@dhyasama/totem-models 9.102.1 → 9.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/LimitedPartnerCampaign.js +3 -0
- package/lib/Organization.js +45 -2
- package/package.json +1 -1
|
@@ -22,6 +22,9 @@ module.exports = function(mongoose, config) {
|
|
|
22
22
|
// recipients can contact this email address
|
|
23
23
|
replyTo: { type: String, trim: true },
|
|
24
24
|
|
|
25
|
+
// additional emails to cc
|
|
26
|
+
cc: [{ type: String, trim: true }],
|
|
27
|
+
|
|
25
28
|
// email subject
|
|
26
29
|
subject: { type: String, trim: true },
|
|
27
30
|
|
package/lib/Organization.js
CHANGED
|
@@ -111,6 +111,18 @@ module.exports = function(mongoose, config) {
|
|
|
111
111
|
}]
|
|
112
112
|
},
|
|
113
113
|
|
|
114
|
+
merged: {
|
|
115
|
+
public: {
|
|
116
|
+
with: { type: Schema.ObjectId, ref: 'Organization' },
|
|
117
|
+
mergedOn: { type: Date, default: null },
|
|
118
|
+
},
|
|
119
|
+
private: [{
|
|
120
|
+
customer: { type: Schema.ObjectId, ref: 'Organization' },
|
|
121
|
+
with: { type: Schema.ObjectId, ref: 'Organization' },
|
|
122
|
+
mergedOn: { type: Date, default: null },
|
|
123
|
+
}]
|
|
124
|
+
},
|
|
125
|
+
|
|
114
126
|
acquired: {
|
|
115
127
|
public: {
|
|
116
128
|
by: { type: Schema.ObjectId, ref: 'Organization' },
|
|
@@ -600,6 +612,36 @@ module.exports = function(mongoose, config) {
|
|
|
600
612
|
|
|
601
613
|
});
|
|
602
614
|
|
|
615
|
+
Organization.virtual('merged.with').get(function () {
|
|
616
|
+
|
|
617
|
+
const self = this;
|
|
618
|
+
const publicData = self.operating.merged.public || {};
|
|
619
|
+
const privateData = self.operating.merged.private || [];
|
|
620
|
+
|
|
621
|
+
if (publicData.with) return publicData.with;
|
|
622
|
+
else if (privateData.length >= 1) {
|
|
623
|
+
if (privateData[0].with) return privateData[0].with;
|
|
624
|
+
else return null;
|
|
625
|
+
}
|
|
626
|
+
else return null;
|
|
627
|
+
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
Organization.virtual('merged.on').get(function () {
|
|
631
|
+
|
|
632
|
+
const self = this;
|
|
633
|
+
const publicData = self.operating.merged.public || {};
|
|
634
|
+
const privateData = self.operating.merged.private || [];
|
|
635
|
+
|
|
636
|
+
if (publicData.mergedOn) return publicData.mergedOn;
|
|
637
|
+
else if (privateData.length >= 1) {
|
|
638
|
+
if (privateData[0].mergedOn) return privateData[0].mergedOn;
|
|
639
|
+
else return null;
|
|
640
|
+
}
|
|
641
|
+
else return null;
|
|
642
|
+
|
|
643
|
+
});
|
|
644
|
+
|
|
603
645
|
Organization.virtual('address.primary').get(function () {
|
|
604
646
|
var primary = _.find(this.contact.address, function(address) {
|
|
605
647
|
return address.primary;
|
|
@@ -823,8 +865,9 @@ module.exports = function(mongoose, config) {
|
|
|
823
865
|
|
|
824
866
|
const self = this;
|
|
825
867
|
|
|
826
|
-
if (self.ipo.ticker) return 'IPO';
|
|
827
|
-
else if (self.acquired.by || self.acquired.on) return 'Acquired';
|
|
868
|
+
if (self.ipo && self.ipo.ticker) return 'IPO';
|
|
869
|
+
else if (self.acquired && (self.acquired.by || self.acquired.on)) return 'Acquired';
|
|
870
|
+
else if (self.merged && (self.merged.with || self.merged.on)) return 'Merged';
|
|
828
871
|
else if (self.shutdown) return 'Shutdown';
|
|
829
872
|
else if (self.inactive) return 'Inactive';
|
|
830
873
|
else return 'Active';
|