@dhyasama/totem-models 8.35.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 +10 -5
- package/lib/Organization.js +12 -4
- package/package.json +1 -1
package/lib/Financials.js
CHANGED
|
@@ -101,12 +101,17 @@ module.exports = function(mongoose, config) {
|
|
|
101
101
|
amount: { type: Number, default: 0 },
|
|
102
102
|
breakdown: { type: Schema.Types.Mixed }
|
|
103
103
|
},
|
|
104
|
+
|
|
105
|
+
documents: [{
|
|
106
|
+
_id: false,
|
|
107
|
+
name: { type: String, trim: true },
|
|
108
|
+
document: { type: Schema.ObjectId, ref: 'Document' },
|
|
109
|
+
}],
|
|
104
110
|
|
|
105
111
|
metrics: { type: Schema.Types.Mixed },
|
|
106
112
|
questions: { type: Schema.Types.Mixed },
|
|
107
113
|
|
|
108
114
|
comment: { type: String, trim: true },
|
|
109
|
-
documents: [ { type: Schema.ObjectId, ref: 'Document' } ],
|
|
110
115
|
|
|
111
116
|
submittedOn: { type: Date, index: false },
|
|
112
117
|
submittedBy: { type: String, trim: true },
|
|
@@ -214,7 +219,7 @@ module.exports = function(mongoose, config) {
|
|
|
214
219
|
'customer': customerId,
|
|
215
220
|
'organization': orgId
|
|
216
221
|
}).populate({
|
|
217
|
-
path: 'snapshots.documents',
|
|
222
|
+
path: 'snapshots.documents.document',
|
|
218
223
|
match: { customer: customerId }
|
|
219
224
|
});
|
|
220
225
|
|
|
@@ -232,7 +237,7 @@ module.exports = function(mongoose, config) {
|
|
|
232
237
|
|
|
233
238
|
query.populate('organization', 'name logoUrl');
|
|
234
239
|
query.populate('customer');
|
|
235
|
-
query.populate('snapshots.documents');
|
|
240
|
+
query.populate('snapshots.documents.document');
|
|
236
241
|
|
|
237
242
|
query.exec(function (err, result) {
|
|
238
243
|
|
|
@@ -248,8 +253,8 @@ module.exports = function(mongoose, config) {
|
|
|
248
253
|
|
|
249
254
|
_.each(result.snapshots, function (snapshot) {
|
|
250
255
|
|
|
251
|
-
snapshot.documents = _.
|
|
252
|
-
return document.customer.toString()
|
|
256
|
+
snapshot.documents = _.reject(snapshot.documents, function (d) {
|
|
257
|
+
return d.document && d.document.customer.toString() !== result.customer._id.toString();
|
|
253
258
|
});
|
|
254
259
|
|
|
255
260
|
});
|
package/lib/Organization.js
CHANGED
|
@@ -208,7 +208,6 @@ module.exports = function(mongoose, config) {
|
|
|
208
208
|
portfolio: {
|
|
209
209
|
|
|
210
210
|
reports: [{
|
|
211
|
-
|
|
212
211
|
name: { type: String, trim: true },
|
|
213
212
|
filters: [{
|
|
214
213
|
_id: false,
|
|
@@ -219,13 +218,22 @@ module.exports = function(mongoose, config) {
|
|
|
219
218
|
by: { type: String, trim: true },
|
|
220
219
|
reverse: { type: Boolean, default: false }
|
|
221
220
|
},
|
|
222
|
-
fields: [
|
|
223
|
-
|
|
221
|
+
fields: [{ type: String, trim: true }],
|
|
224
222
|
}],
|
|
225
223
|
|
|
226
|
-
financials
|
|
224
|
+
financials: {
|
|
227
225
|
active: { type: Boolean, default: false },
|
|
228
226
|
managedServices: { type: Boolean, default: false },
|
|
227
|
+
reminders: {
|
|
228
|
+
frequency: { type: Number, default: 7 },
|
|
229
|
+
occurences: { type: Number, default: 3 },
|
|
230
|
+
},
|
|
231
|
+
documents: [{
|
|
232
|
+
_id: false,
|
|
233
|
+
name: { type: String, trim: true },
|
|
234
|
+
description: { type: String, trim: true },
|
|
235
|
+
required: { type: Boolean, default: false }
|
|
236
|
+
}],
|
|
229
237
|
metrics: [{
|
|
230
238
|
_id: false,
|
|
231
239
|
name: { type: String, trim: true },
|