@dhyasama/totem-models 5.2.1 → 5.3.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
@@ -18,12 +18,12 @@ module.exports = function(mongoose, config) {
18
18
 
19
19
  sources: [{
20
20
  person: { type: Schema.ObjectId, ref: 'Person', required: true },
21
- type: { type: String, enum: ['Inbound', 'Outbound', 'Event', 'Referral', 'Other'], required: true }
21
+ type: { type: String, enum: ['inbound', 'outbound', 'event', 'referral', 'other'], required: true }
22
22
  }],
23
23
 
24
24
  referrers: [{
25
25
  person: { type: Schema.ObjectId, ref: 'Person', required: true },
26
- type: { type: String, enum: ['Founder', 'Investor', 'Service provider', 'Friends and family', 'Limited partner', 'Other'], required: true }
26
+ type: { type: String, enum: ['founder', 'investor', 'service-provider', 'friends-and-family', 'limited-partner', 'other'], required: true }
27
27
  }],
28
28
 
29
29
  documents: [ { type: Schema.ObjectId, ref: 'Document' } ],
@@ -106,6 +106,7 @@ module.exports = function(mongoose, config) {
106
106
  .populate('organization', 'name logoUrl website websiteAliases')
107
107
  .populate('messages')
108
108
  .populate('sources.person', 'name avatarUrl title')
109
+ .populate('referrers.person', 'name avatarUrl title')
109
110
  .populate({
110
111
  path: 'documents',
111
112
  match: { customer: config.CUSTOMER_ID }
@@ -116,7 +117,7 @@ module.exports = function(mongoose, config) {
116
117
  };
117
118
 
118
119
  // Get all deals belonging to a customer
119
- Deal.statics.getForCustomer = function (customerId, cb) {
120
+ Deal.statics.getForCustomer = function (customerId, activeCustomerStages, cb) {
120
121
 
121
122
  var self = this;
122
123
 
@@ -124,10 +125,11 @@ module.exports = function(mongoose, config) {
124
125
  console.log('customerId', customerId);
125
126
 
126
127
  self
127
- .find({ 'customer': customerId })
128
- .populate('organization', 'name description logoUrl website websiteAliases')
128
+ .find({ 'customer': customerId, 'stage': { $in: activeCustomerStages } })
129
+ .populate('organization', 'name description logoUrl website websiteAliases chairs')
129
130
  .populate('messages')
130
- .populate('sources.person', 'name avatarUrl')
131
+ .populate('sources.person', 'name avatarUrl title')
132
+ .populate('referrers.person', 'name avatarUrl title')
131
133
  .populate({
132
134
  path: 'documents',
133
135
  match: { customer: customerId }
@@ -149,6 +151,7 @@ module.exports = function(mongoose, config) {
149
151
  .populate('organization', 'name logoUrl website websiteAliases')
150
152
  .populate('messages')
151
153
  .populate('sources.person', 'name avatarUrl title')
154
+ .populate('referrers.person', 'name avatarUrl title')
152
155
  .populate({
153
156
  path: 'documents',
154
157
  match: { customer: config.CUSTOMER_ID }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "5.2.1",
3
+ "version": "5.3.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",
@@ -15,11 +15,11 @@
15
15
  "@dhyasama/ffvc-crypto": "^1.0.0",
16
16
  "@dhyasama/ffvc-geoip": "^1.0.0",
17
17
  "@dhyasama/ffvc-s3": "^1.0.0",
18
- "@dhyasama/ffvc-utilities": "^2.5.0",
18
+ "@dhyasama/ffvc-utilities": "^2.5.1",
19
19
  "async": "^2.6.1",
20
20
  "awesome-phonenumber": "^1.0.14",
21
21
  "bcrypt": "^0.8.0",
22
- "bluebird": "^3.5.2",
22
+ "bluebird": "^3.5.3",
23
23
  "escape-string-regexp": "^1.0.5",
24
24
  "moment": "^2.22.2",
25
25
  "mongoose-deep-populate": "^3.0.0",
package/.npmignore DELETED
@@ -1,14 +0,0 @@
1
- lib-cov
2
- *.seed
3
- *.log
4
- *.csv
5
- *.dat
6
- *.out
7
- *.pid
8
- *.gz
9
-
10
- npm-debug.log
11
- node_modules
12
-
13
- .DS_Store
14
- .idea