@dhyasama/totem-models 2.3.3 → 2.4.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
@@ -20,7 +20,7 @@ module.exports = function(mongoose, config) {
20
20
  customer: { type: Schema.ObjectId, ref: 'Organization', required: true, index: true },
21
21
 
22
22
  asOfDate: { type: Date, required: true },
23
- monthlyBurn: { type: Number, default: 0 },
23
+ monthlyNetBurn: { type: Number, default: 0 },
24
24
  monthsOfRunway: { type: Number, default: 0 },
25
25
  totalCash: { type: Number, default: 0 },
26
26
  totalDebt: { type: Number, default: 0 },
@@ -8,6 +8,7 @@ module.exports = function(mongoose, config) {
8
8
  var Note = mongoose.model('Note');
9
9
  var Organization = mongoose.model('Organization');
10
10
  var Person = mongoose.model('Person');
11
+ var utilities = require('@dhyasama/ffvc-utilities');
11
12
  var moment = require('moment');
12
13
 
13
14
  var Interaction = new Schema({
@@ -69,10 +70,13 @@ module.exports = function(mongoose, config) {
69
70
 
70
71
  };
71
72
 
72
- Interaction.statics.getForCustomer = function getForCustomer(customerId, cb) {
73
+ Interaction.statics.getForCustomer = function getForCustomer(customerId, since, cb) {
74
+
75
+ since = since || moment().subtract(100, 'years').startOf('day').toString()
76
+ var sinceObjectId = utilities.convertTimestampToObjectId(since);
73
77
 
74
78
  var self = this;
75
- var query = self.find({ totemCustomerId: customerId });
79
+ var query = self.find({ totemCustomerId: customerId, _id: { $gt: sinceObjectId } });
76
80
 
77
81
  query.exec(cb);
78
82
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "2.3.3",
3
+ "version": "2.4.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",