@dhyasama/totem-models 5.10.0 → 5.10.1

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
@@ -46,7 +46,7 @@ module.exports = function(mongoose, config) {
46
46
 
47
47
  history: [{
48
48
  timestamp: { type: Date, required: true, default: Date.now },
49
- account: { type: Schema.ObjectId, ref: 'Person', required: true },
49
+ account: { type: Schema.ObjectId, ref: 'Account', required: true },
50
50
  stage: { type: String, required: true },
51
51
  fundraise: {
52
52
  amount: { type: Number, default: 0 },
@@ -172,6 +172,7 @@ module.exports = function(mongoose, config) {
172
172
  .populate('messages')
173
173
  .populate('sources.person', 'name avatarUrl title')
174
174
  .populate('referrers.person', 'name avatarUrl title')
175
+ .populate('votes.account', 'name avatarUrl title')
175
176
  .populate({
176
177
  path: 'documents',
177
178
  match: { customer: customerId }
@@ -224,9 +225,12 @@ module.exports = function(mongoose, config) {
224
225
  match: { customer: config.CUSTOMER_ID }
225
226
  })
226
227
  .exec(function(err, deal) {
227
- deal.deepPopulate('history.account.person', {
228
- populate: { 'history.account.person': { select: 'name avatarUrl title doNotDisplay' } }
229
- }, cb);
228
+ if(deal && deal.history) {
229
+ deal.deepPopulate('history.account.person', {
230
+ populate: { 'history.account.person': { select: 'name avatarUrl title doNotDisplay' } }
231
+ }, cb);
232
+ }
233
+ else cb(err, deal);
230
234
  });
231
235
  };
232
236
 
@@ -210,7 +210,7 @@ module.exports = function(mongoose, config) {
210
210
  active: { type: Boolean, default: true }
211
211
  }],
212
212
  voting: {
213
- active: { type: Boolean, default: true },
213
+ active: { type: Boolean, default: false },
214
214
  votes: [{
215
215
  name: { type: String, trim: true },
216
216
  value: { type: Number }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "5.10.0",
3
+ "version": "5.10.1",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",