@dhyasama/totem-models 6.30.1 → 6.30.2

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
@@ -141,17 +141,24 @@ module.exports = function(mongoose, config) {
141
141
 
142
142
  Financials.statics.removeCustomerFinancials = function removeCustomerFinancials(customerId, cb) {
143
143
 
144
+ // this is only used to wipe out financials created by the google sheet import process
145
+ // we do NOT want to delete any financials submitted via forms generated directly from the app
146
+
144
147
  var self = this;
145
148
 
146
149
  self
147
- .remove({customer: customerId})
148
- .exec(cb);
150
+ .update(
151
+ { customer: customerId },
152
+ { $pull : { snapshots: { uuid : null, submittedOn: null, submittedBy: null } } },
153
+ { multi : true }
154
+ ).exec(cb);
149
155
 
150
156
  };
151
157
 
152
158
  Financials.statics.upsert = function upsert(financials, cb) {
153
159
  if (!financials) { return cb(new Error('financials is required'), null); }
154
160
  financials.save(function(err, result) {
161
+ console.log(result);
155
162
  return cb(null, result);
156
163
  });
157
164
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "6.30.1",
3
+ "version": "6.30.2",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",