@dhyasama/totem-models 10.42.0 → 10.44.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/Document.js +1 -1
- package/lib/Message.js +13 -0
- package/package.json +1 -1
package/lib/Document.js
CHANGED
|
@@ -45,7 +45,7 @@ module.exports = function(mongoose, config) {
|
|
|
45
45
|
summary: { type: String },
|
|
46
46
|
insights: [{
|
|
47
47
|
text: { type: String },
|
|
48
|
-
category: { type: String, enum: ['
|
|
48
|
+
category: { type: String, enum: ['highlight', 'lowlight', 'goal', 'ask'] },
|
|
49
49
|
page: { type: Number, default: -1 }
|
|
50
50
|
}]
|
|
51
51
|
},
|
package/lib/Message.js
CHANGED
|
@@ -177,6 +177,19 @@ module.exports = function(mongoose, config) {
|
|
|
177
177
|
|
|
178
178
|
};
|
|
179
179
|
|
|
180
|
+
Message.statics.getForDocument = function getForCustomer(docId, cb) {
|
|
181
|
+
|
|
182
|
+
if (!cb) { throw new Error('cb is required'); }
|
|
183
|
+
if (!docId) { return cb(new Error('docId is required'), null); }
|
|
184
|
+
if (!mongoose.Types.ObjectId.isValid(docId)) { return cb(new Error('docId is not a valid ObjectId'), null); }
|
|
185
|
+
|
|
186
|
+
const self = this;
|
|
187
|
+
let query = self.findOne({ documents: { $in: [docId] } });
|
|
188
|
+
|
|
189
|
+
query.exec(cb);
|
|
190
|
+
|
|
191
|
+
};
|
|
192
|
+
|
|
180
193
|
Message.statics.getForOrg = function getForOrg(orgId, options, cb) {
|
|
181
194
|
|
|
182
195
|
if (!cb) { throw new Error('cb is required'); }
|