@dhyasama/totem-models 11.32.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 +6 -36
- package/package.json +1 -1
|
@@ -62,18 +62,14 @@ module.exports = function(mongoose, config) {
|
|
|
62
62
|
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
FinancialsAnalysis.statics.getByFinancials= function getByFinancials(
|
|
65
|
+
FinancialsAnalysis.statics.getByFinancials = function getByFinancials(financials, cb) {
|
|
66
66
|
|
|
67
67
|
let self = this;
|
|
68
68
|
|
|
69
|
-
let query = self.
|
|
70
|
-
'
|
|
69
|
+
let query = self.find({
|
|
70
|
+
'_id': financials
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
-
query.populate('organization', 'name logoUrl website');
|
|
74
|
-
query.populate('customer');
|
|
75
|
-
query.populate('snapshots.documents.document');
|
|
76
|
-
|
|
77
73
|
query.exec(function (err, result) {
|
|
78
74
|
|
|
79
75
|
if (err) {
|
|
@@ -82,17 +78,6 @@ module.exports = function(mongoose, config) {
|
|
|
82
78
|
else if (!result) {
|
|
83
79
|
return cb(null, null);
|
|
84
80
|
}
|
|
85
|
-
else if (!result.customer) {
|
|
86
|
-
return cb(null, null);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
_.each(result.snapshots, function (snapshot) {
|
|
90
|
-
|
|
91
|
-
snapshot.documents = _.reject(snapshot.documents, function (d) {
|
|
92
|
-
return d.document && d.document.customer.toString() !== result.customer._id.toString();
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
});
|
|
96
81
|
|
|
97
82
|
return cb(null, result);
|
|
98
83
|
|
|
@@ -100,18 +85,14 @@ module.exports = function(mongoose, config) {
|
|
|
100
85
|
|
|
101
86
|
};
|
|
102
87
|
|
|
103
|
-
FinancialsAnalysis.statics.
|
|
88
|
+
FinancialsAnalysis.statics.getBySnapshotUUID = function getBySnapshotUUID(uuids, cb) {
|
|
104
89
|
|
|
105
90
|
let self = this;
|
|
106
91
|
|
|
107
|
-
let query = self.
|
|
108
|
-
'
|
|
92
|
+
let query = self.find({
|
|
93
|
+
'snapshotUUID': uuids
|
|
109
94
|
});
|
|
110
95
|
|
|
111
|
-
query.populate('organization', 'name logoUrl website');
|
|
112
|
-
query.populate('customer');
|
|
113
|
-
query.populate('snapshots.documents.document');
|
|
114
|
-
|
|
115
96
|
query.exec(function (err, result) {
|
|
116
97
|
|
|
117
98
|
if (err) {
|
|
@@ -120,17 +101,6 @@ module.exports = function(mongoose, config) {
|
|
|
120
101
|
else if (!result) {
|
|
121
102
|
return cb(null, null);
|
|
122
103
|
}
|
|
123
|
-
else if (!result.customer) {
|
|
124
|
-
return cb(null, null);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
_.each(result.snapshots, function (snapshot) {
|
|
128
|
-
|
|
129
|
-
snapshot.documents = _.reject(snapshot.documents, function (d) {
|
|
130
|
-
return d.document && d.document.customer.toString() !== result.customer._id.toString();
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
});
|
|
134
104
|
|
|
135
105
|
return cb(null, result);
|
|
136
106
|
|