@dhyasama/totem-models 8.56.0 → 8.57.2

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/Account.js CHANGED
@@ -120,6 +120,38 @@ module.exports = function(mongoose, config) {
120
120
  });
121
121
  };
122
122
 
123
+ Account.statics.findByEmails = function(emails, cb) {
124
+
125
+ let self = this;
126
+
127
+ if (!cb) { throw new Error('cb is required'); }
128
+ if (!emails) { return cb(new Error('email is required'), null); }
129
+
130
+ self
131
+ .find({ 'email': { $in : emails }})
132
+ .populate('person')
133
+ .exec(function(err, accounts) {
134
+
135
+ if (err) { return cb(err); }
136
+ else if (!accounts) { return cb(null, null); }
137
+
138
+ _.each(accounts, function(account) {
139
+
140
+ if (account.populated('person')) {
141
+
142
+ if (account.org) { helpers.cleanPerson(account.person, account.org); }
143
+ else { account.person.sources = []; }
144
+
145
+ }
146
+
147
+ });
148
+
149
+ return cb(null, accounts);
150
+
151
+ });
152
+
153
+ };
154
+
123
155
  Account.statics.getById = function (id, cb) {
124
156
 
125
157
  const self = this;
package/lib/Deal.js CHANGED
@@ -156,7 +156,7 @@ module.exports = function(mongoose, config) {
156
156
 
157
157
  query.populate({ path: 'documents', match: { customer: options.CUSTOMER_ID } });
158
158
  query.populate({ path: 'messages', match: { customer: options.CUSTOMER_ID } });
159
- query.populate('organization', 'name description logoUrl website websiteAliases chairs contact');
159
+ query.populate('organization', 'name aliases description logoUrl website websiteAliases chairs contact');
160
160
  query.populate('referrer.person', 'name avatarUrl title');
161
161
  query.exec(cb);
162
162
 
@@ -179,7 +179,7 @@ module.exports = function(mongoose, config) {
179
179
 
180
180
  query.populate({ path: 'documents', match: { customer: options.CUSTOMER_ID } });
181
181
  query.populate({ path: 'messages', match: { customer: options.CUSTOMER_ID } });
182
- query.populate('organization', 'name description logoUrl website websiteAliases chairs contact');
182
+ query.populate('organization', 'name aliases description logoUrl website websiteAliases chairs contact');
183
183
  query.populate('referrer.person', 'name avatarUrl title');
184
184
  query.exec(cb);
185
185
 
@@ -232,7 +232,7 @@ module.exports = function(mongoose, config) {
232
232
 
233
233
  query.populate({ path: 'documents', match: { customer: options.CUSTOMER_ID } });
234
234
  query.populate({ path: 'messages', match: { customer: options.CUSTOMER_ID } });
235
- query.populate('organization', 'name description logoUrl website websiteAliases');
235
+ query.populate('organization', 'name aliases description logoUrl website websiteAliases');
236
236
  query.exec(cb);
237
237
 
238
238
  };
@@ -256,7 +256,7 @@ module.exports = function(mongoose, config) {
256
256
 
257
257
  query.populate({ path: 'documents', match: { customer: options.CUSTOMER_ID } });
258
258
  query.populate({ path: 'messages', match: { customer: options.CUSTOMER_ID } });
259
- query.populate('organization', 'name logoUrl website websiteAliases');
259
+ query.populate('organization', 'name aliases logoUrl website websiteAliases');
260
260
  query.populate('referrer.person', 'name avatarUrl title');
261
261
  query.exec(cb);
262
262
 
package/lib/Round.js CHANGED
@@ -128,6 +128,7 @@ module.exports = function(mongoose, config) {
128
128
  _id: rounds[0].organization._id,
129
129
  slug: rounds[0].organization.slug,
130
130
  name: rounds[0].organization.name,
131
+ aliases: rounds[0].organization.aliases,
131
132
  logoUrl: rounds[0].organization.logoUrl,
132
133
  description: rounds[0].organization.description,
133
134
  website: rounds[0].organization.website,
@@ -567,7 +568,7 @@ module.exports = function(mongoose, config) {
567
568
  let query = self.find({ 'vehicles.fund': fundId });
568
569
 
569
570
  query.select('organization vehicles');
570
- query.populate('organization', 'name slug logoUrl description contact filters status ipo closed acquired operating website websiteAliases');
571
+ query.populate('organization', 'name aliases slug logoUrl description contact filters status ipo closed acquired operating website websiteAliases');
571
572
  query.populate('vehicles.fund');
572
573
 
573
574
  if (options.isWorkerProcess) {
@@ -621,7 +622,7 @@ module.exports = function(mongoose, config) {
621
622
  let query = self.find({ 'vehicles.fund': { $in: fundIds } });
622
623
 
623
624
  query.select('organization vehicles');
624
- query.populate('organization', 'name slug logoUrl description contact chairs filters status ipo closed acquired operating website websiteAliases');
625
+ query.populate('organization', 'name aliases slug logoUrl description contact chairs filters status ipo closed acquired operating website websiteAliases');
625
626
  query.deepPopulate([
626
627
  'organization.chairs.first',
627
628
  'organization.chairs.second',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "8.56.0",
3
+ "version": "8.57.2",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",