@dhyasama/totem-models 7.22.0 → 7.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/Financials.js CHANGED
@@ -122,10 +122,10 @@ module.exports = function(mongoose, config) {
122
122
 
123
123
  company: {
124
124
 
125
- sendTo: {
125
+ sendTo: [{
126
126
  email: { type: String, trim: true },
127
127
  name: { type: String, trim: true }
128
- },
128
+ }],
129
129
 
130
130
  initial: {
131
131
  sendOn: { type: Date, required: false },
@@ -332,7 +332,7 @@ module.exports = function(mongoose, config) {
332
332
  var query = self.find({
333
333
  'snapshots': {
334
334
  $elemMatch: {
335
- 'notifications.company.sendTo.email': { $ne: null },
335
+ 'notifications.company.sendTo': { $gt: [] },
336
336
  'notifications.company.initial.sendOn': { $lte: now },
337
337
  'notifications.company.initial.sentOn': null,
338
338
  'submittedOn': null
@@ -350,7 +350,7 @@ module.exports = function(mongoose, config) {
350
350
 
351
351
  snapshots = _.filter(snapshots, function(snapshot) {
352
352
 
353
- var bool = !!snapshot.notifications.company.sendTo.email;
353
+ var bool = !!snapshot.notifications.company.sendTo.length > 0;
354
354
  bool = bool && snapshot.notifications.company.initial.sendOn < now;
355
355
  bool = bool && !snapshot.notifications.company.initial.sentOn;
356
356
 
@@ -372,7 +372,7 @@ module.exports = function(mongoose, config) {
372
372
  var query = self.find({
373
373
  'snapshots': {
374
374
  $elemMatch: {
375
- 'notifications.company.sendTo.email': { $ne: null },
375
+ 'notifications.company.sendTo': { $gt: [] },
376
376
  'notifications.company.reminder.sendOn': { $lte: now },
377
377
  'notifications.company.reminder.sentOn': null,
378
378
  'submittedOn': null
@@ -390,7 +390,7 @@ module.exports = function(mongoose, config) {
390
390
 
391
391
  snapshots = _.filter(snapshots, function(snapshot) {
392
392
 
393
- var bool = !!snapshot.notifications.company.sendTo.email;
393
+ var bool = !!snapshot.notifications.company.sendTo.length > 0;
394
394
  bool = bool && snapshot.notifications.company.reminder.sendOn < now;
395
395
  bool = bool && !snapshot.notifications.company.reminder.sentOn;
396
396
 
@@ -2163,7 +2163,7 @@ module.exports = function(mongoose, config) {
2163
2163
 
2164
2164
  var CUSTOMER_ID = config.CUSTOMER_ID;
2165
2165
 
2166
- if (CUSTOMER_ID == 'GLOBAL_PROCESS') return next();
2166
+ if (CUSTOMER_ID == 'GLOBAL_PROCESS' && next) return next();
2167
2167
 
2168
2168
  // remove customer details if not viewing self
2169
2169
  if (doc._id.toString() != CUSTOMER_ID) doc.customer = {};
@@ -2195,7 +2195,7 @@ module.exports = function(mongoose, config) {
2195
2195
 
2196
2196
  });
2197
2197
 
2198
- return next();
2198
+ if (next) return next();
2199
2199
 
2200
2200
  });
2201
2201
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "7.22.0",
3
+ "version": "7.23.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",