@dhyasama/totem-models 8.36.0 → 8.37.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
@@ -29,6 +29,8 @@ module.exports = function(mongoose, config) {
29
29
 
30
30
  uuid: { type: String },
31
31
 
32
+ managedServices: { type: Boolean, default: false, required: true },
33
+
32
34
  status: { type: String },
33
35
  action: { type: String },
34
36
 
@@ -99,12 +101,17 @@ module.exports = function(mongoose, config) {
99
101
  amount: { type: Number, default: 0 },
100
102
  breakdown: { type: Schema.Types.Mixed }
101
103
  },
104
+
105
+ documents: [{
106
+ _id: false,
107
+ name: { type: String, trim: true },
108
+ document: { type: Schema.ObjectId, ref: 'Document' },
109
+ }],
102
110
 
103
111
  metrics: { type: Schema.Types.Mixed },
104
112
  questions: { type: Schema.Types.Mixed },
105
113
 
106
114
  comment: { type: String, trim: true },
107
- documents: [ { type: Schema.ObjectId, ref: 'Document' } ],
108
115
 
109
116
  submittedOn: { type: Date, index: false },
110
117
  submittedBy: { type: String, trim: true },
@@ -212,7 +219,7 @@ module.exports = function(mongoose, config) {
212
219
  'customer': customerId,
213
220
  'organization': orgId
214
221
  }).populate({
215
- path: 'snapshots.documents',
222
+ path: 'snapshots.documents.document',
216
223
  match: { customer: customerId }
217
224
  });
218
225
 
@@ -230,7 +237,7 @@ module.exports = function(mongoose, config) {
230
237
 
231
238
  query.populate('organization', 'name logoUrl');
232
239
  query.populate('customer');
233
- query.populate('snapshots.documents');
240
+ query.populate('snapshots.documents.document');
234
241
 
235
242
  query.exec(function (err, result) {
236
243
 
@@ -246,8 +253,8 @@ module.exports = function(mongoose, config) {
246
253
 
247
254
  _.each(result.snapshots, function (snapshot) {
248
255
 
249
- snapshot.documents = _.filter(snapshot.documents, function (document) {
250
- return document.customer.toString() === result.customer._id.toString();
256
+ snapshot.documents = _.reject(snapshot.documents, function (d) {
257
+ return d.document && d.document.customer.toString() !== result.customer._id.toString();
251
258
  });
252
259
 
253
260
  });
@@ -218,16 +218,13 @@ module.exports = function(mongoose, config) {
218
218
  by: { type: String, trim: true },
219
219
  reverse: { type: Boolean, default: false }
220
220
  },
221
- fields: [ {type: String, trim: true} ],
221
+ fields: [{ type: String, trim: true }],
222
222
  }],
223
223
 
224
224
  financials: {
225
225
  active: { type: Boolean, default: false },
226
- approval: {
227
- active: { type: Boolean, default: false }
228
- },
226
+ managedServices: { type: Boolean, default: false },
229
227
  reminders: {
230
- active: { type: Boolean, default: false },
231
228
  frequency: { type: Number, default: 7 },
232
229
  occurences: { type: Number, default: 3 },
233
230
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "8.36.0",
3
+ "version": "8.37.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",