@tiledesk/tiledesk-server 2.3.86 → 2.3.88
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/CHANGELOG.md +4 -1
- package/models/faq_kb.js +14 -2
- package/package.json +1 -1
- package/routes/faq_kb.js +2 -2
- package/services/geoService.js +4 -4
package/CHANGELOG.md
CHANGED
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',
|
|
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
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/services/geoService.js
CHANGED
|
@@ -74,9 +74,9 @@ class GeoService {
|
|
|
74
74
|
if (geo) {
|
|
75
75
|
var update = {};
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
if (!request.location) {
|
|
78
|
+
request.location = {};
|
|
79
|
+
}
|
|
80
80
|
|
|
81
81
|
if (geo.country && !request.location.country) {
|
|
82
82
|
winston.debug("geo.country:"+ geo.country);
|
|
@@ -98,7 +98,7 @@ class GeoService {
|
|
|
98
98
|
if (!request.location.ipAddress) {
|
|
99
99
|
winston.debug("request.location.ipAddress: " + request.location.ipAddress);
|
|
100
100
|
// request.location.ipAddress = ip;
|
|
101
|
-
update["location.
|
|
101
|
+
update["location.ipAddress"] = ip;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
// console.log(request.location.toString());
|