@dhyasama/totem-models 11.31.0 → 11.33.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/FinancialsAnalysis.js +11 -37
- package/package.json +1 -1
|
@@ -26,7 +26,11 @@ module.exports = function(mongoose, config) {
|
|
|
26
26
|
|
|
27
27
|
summary: { type: String },
|
|
28
28
|
|
|
29
|
-
insights: [{
|
|
29
|
+
insights: [{
|
|
30
|
+
text: { type: String },
|
|
31
|
+
category: { type: String, enum: ['highlight', 'lowlight', 'goal', 'ask'] },
|
|
32
|
+
page: { type: Number, default: -1 }
|
|
33
|
+
}]
|
|
30
34
|
|
|
31
35
|
});
|
|
32
36
|
|
|
@@ -58,18 +62,14 @@ module.exports = function(mongoose, config) {
|
|
|
58
62
|
|
|
59
63
|
};
|
|
60
64
|
|
|
61
|
-
FinancialsAnalysis.statics.getByFinancials= function getByFinancials(
|
|
65
|
+
FinancialsAnalysis.statics.getByFinancials = function getByFinancials(financials, cb) {
|
|
62
66
|
|
|
63
67
|
let self = this;
|
|
64
68
|
|
|
65
|
-
let query = self.
|
|
66
|
-
'
|
|
69
|
+
let query = self.find({
|
|
70
|
+
'_id': financials
|
|
67
71
|
});
|
|
68
72
|
|
|
69
|
-
query.populate('organization', 'name logoUrl website');
|
|
70
|
-
query.populate('customer');
|
|
71
|
-
query.populate('snapshots.documents.document');
|
|
72
|
-
|
|
73
73
|
query.exec(function (err, result) {
|
|
74
74
|
|
|
75
75
|
if (err) {
|
|
@@ -78,17 +78,6 @@ module.exports = function(mongoose, config) {
|
|
|
78
78
|
else if (!result) {
|
|
79
79
|
return cb(null, null);
|
|
80
80
|
}
|
|
81
|
-
else if (!result.customer) {
|
|
82
|
-
return cb(null, null);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
_.each(result.snapshots, function (snapshot) {
|
|
86
|
-
|
|
87
|
-
snapshot.documents = _.reject(snapshot.documents, function (d) {
|
|
88
|
-
return d.document && d.document.customer.toString() !== result.customer._id.toString();
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
});
|
|
92
81
|
|
|
93
82
|
return cb(null, result);
|
|
94
83
|
|
|
@@ -96,18 +85,14 @@ module.exports = function(mongoose, config) {
|
|
|
96
85
|
|
|
97
86
|
};
|
|
98
87
|
|
|
99
|
-
FinancialsAnalysis.statics.
|
|
88
|
+
FinancialsAnalysis.statics.getBySnapshotUUID = function getBySnapshotUUID(uuids, cb) {
|
|
100
89
|
|
|
101
90
|
let self = this;
|
|
102
91
|
|
|
103
|
-
let query = self.
|
|
104
|
-
'
|
|
92
|
+
let query = self.find({
|
|
93
|
+
'snapshotUUID': uuids
|
|
105
94
|
});
|
|
106
95
|
|
|
107
|
-
query.populate('organization', 'name logoUrl website');
|
|
108
|
-
query.populate('customer');
|
|
109
|
-
query.populate('snapshots.documents.document');
|
|
110
|
-
|
|
111
96
|
query.exec(function (err, result) {
|
|
112
97
|
|
|
113
98
|
if (err) {
|
|
@@ -116,17 +101,6 @@ module.exports = function(mongoose, config) {
|
|
|
116
101
|
else if (!result) {
|
|
117
102
|
return cb(null, null);
|
|
118
103
|
}
|
|
119
|
-
else if (!result.customer) {
|
|
120
|
-
return cb(null, null);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
_.each(result.snapshots, function (snapshot) {
|
|
124
|
-
|
|
125
|
-
snapshot.documents = _.reject(snapshot.documents, function (d) {
|
|
126
|
-
return d.document && d.document.customer.toString() !== result.customer._id.toString();
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
});
|
|
130
104
|
|
|
131
105
|
return cb(null, result);
|
|
132
106
|
|