@tiledesk/tiledesk-server 2.3.87 → 2.3.89

Sign up to get free protection for your applications and to get access to all the features.
package/models/faq_kb.js CHANGED
@@ -92,7 +92,19 @@ var Faq_kbSchema = new Schema({
92
92
  },
93
93
  tags: [{
94
94
  type: String
95
- }]
95
+ }],
96
+ score: {
97
+ type: Number,
98
+ required: false,
99
+ index: true,
100
+ default: 0
101
+ },
102
+ publishedBy: {
103
+ type: String,
104
+ },
105
+ publishedAt: {
106
+ type: Date
107
+ },
96
108
  },{
97
109
  timestamps: true
98
110
  }
@@ -106,7 +118,7 @@ Faq_kbSchema.virtual('fullName').get(function () {
106
118
  Faq_kbSchema.index({certified: 1, public: 1}); //suggested by atlas
107
119
 
108
120
 
109
- Faq_kbSchema.index({name: 'text', description: 'text', subject: 'text', "tags": 'text'},
121
+ Faq_kbSchema.index({name: 'text', description: 'text', "tags": 'text'},
110
122
  {"name":"faqkb_fulltext","default_language": defaultFullTextLanguage,"language_override": "language"}); // schema level
111
123
 
112
124
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-server",
3
3
  "description": "The Tiledesk server module",
4
- "version": "2.3.87",
4
+ "version": "2.3.89",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
package/routes/faq_kb.js CHANGED
@@ -236,7 +236,7 @@ router.put('/:faq_kbid/publish', async (req, res) => {
236
236
  winston.debug("forkedChatBotId: "+forkedChatBotId);
237
237
 
238
238
 
239
- let updatedForkedChabot = await Faq_kb.findByIdAndUpdate(forkedChatBotId, {trashed: true}, { new: true, upsert: true }).exec();
239
+ let updatedForkedChabot = await Faq_kb.findByIdAndUpdate(forkedChatBotId, {trashed: true, publishedBy: req.user.id, publishedAt: new Date().getTime()}, { new: true, upsert: true }).exec();
240
240
  winston.debug("updatedForkedChabot: ",updatedForkedChabot);
241
241
  botEvent.emit('faqbot.update', updatedForkedChabot);
242
242
 
@@ -372,7 +372,7 @@ router.delete('/:faq_kbid', function (req, res) {
372
372
 
373
373
  winston.debug(req.body);
374
374
 
375
-
375
+
376
376
  Faq_kb.remove({ _id: req.params.faq_kbid }, function (err, faq_kb) {
377
377
  if (err) {
378
378
  return res.status(500).send({ success: false, msg: 'Error deleting object.' });
package/routes/images.js CHANGED
@@ -424,6 +424,12 @@ router.get('/thumbnails', (req, res) => {
424
424
 
425
425
  router.get("/", (req, res) => {
426
426
  winston.debug('path', req.query.path);
427
+
428
+ if (req.query.as_attachment) {
429
+ res.set({ "Content-Disposition": "attachment; filename=\""+req.query.path+"\"" });
430
+ }
431
+
432
+
427
433
  // try {
428
434
  fileService.getFileDataAsStream(req.query.path).on('error', (e)=> {
429
435
  if (e.code == "ENOENT") {