@dhyasama/totem-models 8.36.0 → 8.38.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 +12 -5
- package/lib/Organization.js +3 -5
- package/package.json +1 -1
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 = _.
|
|
250
|
-
return document.customer.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
|
});
|
package/lib/Organization.js
CHANGED
|
@@ -218,16 +218,14 @@ module.exports = function(mongoose, config) {
|
|
|
218
218
|
by: { type: String, trim: true },
|
|
219
219
|
reverse: { type: Boolean, default: false }
|
|
220
220
|
},
|
|
221
|
-
fields: [
|
|
221
|
+
fields: [{ type: String, trim: true }],
|
|
222
222
|
}],
|
|
223
223
|
|
|
224
224
|
financials: {
|
|
225
225
|
active: { type: Boolean, default: false },
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
},
|
|
226
|
+
managedServices: { type: Boolean, default: false },
|
|
227
|
+
message: { type: String, trim: true },
|
|
229
228
|
reminders: {
|
|
230
|
-
active: { type: Boolean, default: false },
|
|
231
229
|
frequency: { type: Number, default: 7 },
|
|
232
230
|
occurences: { type: Number, default: 3 },
|
|
233
231
|
},
|