@dhyasama/totem-models 10.62.0 → 10.63.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.
Files changed (2) hide show
  1. package/lib/Financials.js +23 -0
  2. package/package.json +1 -1
package/lib/Financials.js CHANGED
@@ -488,6 +488,29 @@ module.exports = function(mongoose, config) {
488
488
 
489
489
  };
490
490
 
491
+ Financials.statics.getSnapshot = function getSnapshot(snapshotUUID, cb) {
492
+
493
+ if (!cb) { throw new Error('cb is required'); }
494
+ if (!snapshotUUID) { return cb(new Error('snapshotUUID is required'), null); }
495
+
496
+ const self = this;
497
+
498
+ self.aggregate([
499
+ { $unwind: '$snapshots' },
500
+ {
501
+ $project: {
502
+ _id: 1,
503
+ snapshot: '$snapshots'
504
+ }
505
+ }
506
+ ]).exec(function(err, result) {
507
+ if (err) return cb(err);
508
+ else if (!result || result.length === 0) return cb(null, null);
509
+ else return cb(null, result[0]);
510
+ });
511
+
512
+ };
513
+
491
514
  Financials.statics.getRecurringToSend = function getRecurringToSend(options, cb) {
492
515
 
493
516
  const self = this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "10.62.0",
3
+ "version": "10.63.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",