@dhyasama/totem-models 8.75.0 → 8.77.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
@@ -18,6 +18,7 @@ module.exports = function(mongoose, config) {
18
18
  var Organization = mongoose.model('Organization');
19
19
  var _ = require('underscore');
20
20
  var async = require('async');
21
+ var helpers = require('../helpers');
21
22
 
22
23
  var CapTable = new Schema({
23
24
 
@@ -340,6 +341,33 @@ module.exports = function(mongoose, config) {
340
341
 
341
342
  };
342
343
 
344
+ CapTable.statics.search = function (terms, options, cb) {
345
+
346
+ const self = this;
347
+
348
+ if (!cb) { throw new Error('cb is required'); }
349
+ if (!terms) { return cb(new Error('terms is required'), null); }
350
+ if (!options) { return cb(new Error('options is required'), null); }
351
+ if (!options.CUSTOMER_ID) { return cb(new Error('options.CUSTOMER_ID is required'), null); }
352
+ if (!mongoose.Types.ObjectId.isValid(options.CUSTOMER_ID)) { return cb(new Error('options.CUSTOMER_ID is not a valid ObjectId'), null); }
353
+
354
+ options = helpers.getDefaultOptions(options);
355
+
356
+ let query;
357
+
358
+ query = self.find({
359
+ customer: options.CUSTOMER_ID,
360
+ 'stakeholders.name': new RegExp(terms, 'i'),
361
+ 'stakeholders.person': null,
362
+ 'stakeholders.fund': null
363
+ });
364
+
365
+ query.populate('organization', 'name logoUrl');
366
+ query.sort({ 'name': -1 });
367
+ query.exec(cb);
368
+
369
+ };
370
+
343
371
  CapTable.statics.updateOriginalDocumentUrl = function updateOriginalDocumentUrl(id, originalDocumentUrl, cb) {
344
372
 
345
373
  var self = this;
@@ -220,8 +220,13 @@ module.exports = function(mongoose, config) {
220
220
  financials: {
221
221
  active: { type: Boolean, default: false },
222
222
  managedServices: { type: Boolean, default: false },
223
- greeting: { type: String, trim: true },
224
223
  reminders: { type: [Number], default: [7, 7, 7] },
224
+
225
+ messages: [{
226
+ _id: false,
227
+ name: { type: String, trim: true },
228
+ html: { type: String, trim: true }
229
+ }],
225
230
  templates: [{
226
231
  _id: false,
227
232
  name: { type: String, trim: true },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "8.75.0",
3
+ "version": "8.77.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",