@dhyasama/totem-models 8.23.1 → 8.25.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/Deal.js CHANGED
@@ -188,10 +188,6 @@ module.exports = function(mongoose, config) {
188
188
  // Get all deals belonging to a customer
189
189
  Deal.statics.getForCustomer = function (customerId, options, cb) {
190
190
 
191
- // todo - fix deep population
192
- // not sure why chained deepPopulate isn't working (it throws an error)
193
- // it works to deepPopulate each result instance in parallel
194
-
195
191
  let self = this;
196
192
 
197
193
  if (!cb) { throw new Error('cb is required'); }
@@ -213,13 +209,8 @@ module.exports = function(mongoose, config) {
213
209
  else if(options.updated.gte) terms['history'] = { $elemMatch: { timestamp: { $gte: options.updated.gte } } };
214
210
  };
215
211
 
216
- self
217
- .find(terms)
218
- .populate({ path: 'documents', match: { customer: customerId } })
219
- .populate({ path: 'messages', match: { customer: customerId } })
220
- .populate('organization', 'name description logoUrl website websiteAliases chairs contact')
221
- .populate('referrer.person', 'name avatarUrl title')
222
- .exec(cb);
212
+ let query = self.find(terms);
213
+ query.exec(cb);
223
214
 
224
215
  };
225
216
 
package/lib/Message.js CHANGED
@@ -75,7 +75,7 @@ module.exports = function(mongoose, config) {
75
75
 
76
76
  };
77
77
 
78
- Message.statics.deleteDocument = function(docId, cb) {
78
+ Message.statics.deleteDocument = function(docId, customerId, cb) {
79
79
 
80
80
  // Delete the doc itself along with any references
81
81
 
@@ -88,7 +88,7 @@ module.exports = function(mongoose, config) {
88
88
  };
89
89
 
90
90
  async.series([
91
- Document.delete.bind(Document, docId),
91
+ Document.delete.bind(Document, { CUSTOMER_ID: customerId }, docId),
92
92
  removeReferences
93
93
  ], function(err, results) {
94
94
  return cb(err, null);
@@ -169,6 +169,8 @@ module.exports = function(mongoose, config) {
169
169
 
170
170
  active: { type: Boolean, default: false },
171
171
 
172
+ freemium: { type: Boolean, default: false },
173
+
172
174
  totemUrl: { type: String, trim: true, unique: true, partialFilterExpression : { type :"string" } },
173
175
 
174
176
  auth: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "8.23.1",
3
+ "version": "8.25.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",