@dhyasama/totem-models 8.21.0 → 8.23.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 +11 -4
- package/lib/Financials.js +22 -6
- package/package.json +1 -1
package/lib/Deal.js
CHANGED
|
@@ -200,11 +200,18 @@ module.exports = function(mongoose, config) {
|
|
|
200
200
|
|
|
201
201
|
options = options || {};
|
|
202
202
|
|
|
203
|
-
// { history: { $elemMatch: { timestamp: { $gte: ISODate("2019-01-03T20:45:14.406+0000") } } } }
|
|
204
|
-
|
|
205
203
|
let terms = { 'customer': customerId };
|
|
206
|
-
if (options.
|
|
207
|
-
if (options.
|
|
204
|
+
if (options.stages) { terms['stage'] = { $in: options.stages }; }
|
|
205
|
+
if (options.added) {
|
|
206
|
+
if(options.added.lte && options.added.gte) terms['history.0.timestamp'] = { $lte: options.added.lte, $gte: options.added.gte };
|
|
207
|
+
else if(options.added.lte) terms['history.0.timestamp'] = { $lte: options.added.lte };
|
|
208
|
+
else if(options.added.gte) terms['history.0.timestamp'] = { $gte: options.added.gte };
|
|
209
|
+
}
|
|
210
|
+
if (options.updated) {
|
|
211
|
+
if(options.updated.lte && options.updated.gte) terms['history'] = { $elemMatch: { timestamp: { $lte: options.updated.lte, $gte: options.updated.gte } } };
|
|
212
|
+
else if(options.updated.lte) terms['history'] = { $elemMatch: { timestamp: { $lte: options.updated.lte } } };
|
|
213
|
+
else if(options.updated.gte) terms['history'] = { $elemMatch: { timestamp: { $gte: options.updated.gte } } };
|
|
214
|
+
};
|
|
208
215
|
|
|
209
216
|
self
|
|
210
217
|
.find(terms)
|
package/lib/Financials.js
CHANGED
|
@@ -149,13 +149,29 @@ module.exports = function(mongoose, config) {
|
|
|
149
149
|
|
|
150
150
|
},
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
stakeholders: [{
|
|
153
|
+
|
|
153
154
|
organization: { type: Schema.ObjectId, ref: 'Organization' },
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
155
|
+
|
|
156
|
+
sendTo: [{
|
|
157
|
+
email: { type: String, trim: true },
|
|
158
|
+
name: { type: String, trim: true }
|
|
159
|
+
}],
|
|
160
|
+
|
|
161
|
+
initial: {
|
|
162
|
+
sendOn: { type: Date, required: false },
|
|
163
|
+
sentOn: { type: Date, required: false },
|
|
164
|
+
postmarkMessageId: { type: String, trim: true },
|
|
165
|
+
status: { type: String, enum: [null, 'Sent', 'Bounced', 'Delivered', 'Opened', 'Clicked']}
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
reminders: [{
|
|
169
|
+
sendOn: { type: Date, required: false },
|
|
170
|
+
sentOn: { type: Date, required: false },
|
|
171
|
+
postmarkMessageId: { type: String, trim: true },
|
|
172
|
+
status: { type: String, enum: [null, 'Sent', 'Bounced', 'Delivered', 'Opened', 'Clicked']}
|
|
173
|
+
}]
|
|
174
|
+
|
|
159
175
|
}]
|
|
160
176
|
|
|
161
177
|
}
|