Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Giovanni Troisi committed Feb 13, 2023
2 parents e8d56ae + 261f7ce commit 19d72d8
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 23 deletions.
36 changes: 32 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@


💥 TILEDESK SERVER v2.3.71 💥
💥 TILEDESK SERVER v2.3.77 💥
🚀 TAGGED AND PUBLISHED ON NPM 🚀
🚀 IN PRODUCTION 🚀
(https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.71)
(https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)


# 2.3.77 -> PROD v3
- Updated tiledesk/tiledesk-whatsapp-connector dependency to 0.1.24
- Added KALEYRA_API_URL environment variable
- Now GRAPH_URL environment variable is optional
- Added bot cache invalidation for new radis key without project for tilebot
- Added chatbot fulltext endpoint

# 2.3.76
- Adedd tag to bot model
- \\n fix for public private key
- Chatbot invalidation fix when created
- @tiledesk/tiledesk-tybot-connector@0.1.53

# 2.3.75
- @tiledesk/tiledesk-tybot-connector@0.1.51

# 2.3.74
- Added cache for bot
- @tiledesk/tiledesk-tybot-connector@0.1.50
- Added cache for user

# 2.3.73
- Removed unused mongoose-auto-increment dependency
Expand All @@ -19,17 +41,23 @@
- Added caching for /widgets endpoint with invalidations
- Added bot rules to /widgets endpoint
- Select false for resetpswrequestid field of user model
- Added support for Public Private Key for JWT Auth with GLOBAL_SECRET_OR_PRIVATE_KEY and GLOBAL_SECRET_OR_PUB_KEY and GLOBAL_SECRET_ALGORITHM environments variables. If these properties are configured Public Private Key method is enabled otherwise if GLOBAL_SECRET env varible is configured the shared secret method is used. algorithm (default: HS256)
- Added support for Public Private Key for JWT Auth with GLOBAL_SECRET_OR_PRIVATE_KEY and GLOBAL_SECRET_OR_PUB_KEY and GLOBAL_SECRET_ALGORITHM(default: HS256, RS256 for pub private key) environments variables. If these properties are configured Public/Private Key method is enabled otherwise if only GLOBAL_SECRET env varible is configured the shared secret method is used.
- Updated tiledesk/[email protected]
- Removed “snapshot” from request payload for external chatbot
- Added CHATBOT_TEMPLATES_API_URL env varible
- Updated tiledesk/[email protected]




# 2.3.72
- Added Kaleyra module
- Updated tiledesk-apps to 1.0.12

# 2.3.71
# 2.3.71.1 -> PROD v2
- ocf email fix

# 2.3.71
- Email service send email direct fit without request_id
- Removed strong from transcript email template
- Added for updateWaitingTimeByRequestId the field enable_populate
Expand Down
1 change: 1 addition & 0 deletions models/faq.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ FaqSchema.index({ question: 'text' },


FaqSchema.index({ id_project: 1, id_faq_kb: 1, intent_display_name: 1 }, { unique: true });
FaqSchema.index({ id_project: 1, id_faq_kb: 1, intent_id: 1 }, { unique: true });


var faq = mongoose.model('faq', FaqSchema);
Expand Down
6 changes: 4 additions & 2 deletions models/faq_kb.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,14 @@ var Faq_kbSchema = new Schema({
public: {
type: Boolean,
required: false,
default: false
default: false,
index:true
},
certified: {
type: Boolean,
required: false,
default: false
default: false,
index:true
},
mainCategory: {
type: String,
Expand Down
32 changes: 16 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tiledesk/tiledesk-server",
"description": "The Tiledesk server module",
"version": "2.3.76",
"version": "2.3.77",
"scripts": {
"start": "node ./bin/www",
"pretest": "mongodb-runner start",
Expand Down
16 changes: 16 additions & 0 deletions pubmodules/cache/mongoose-cachegoose-fn.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@

faqBotEvent.on("faq.create", function(faq) {
setImmediate(() => {

// TODO invalidate widgets here
winston.verbose("Deleting widgets cache for faq.create");
invalidateWidgets(client, faq.id_project); //tested
Expand All @@ -483,6 +484,8 @@

faqBotEvent.on("faq.update", function(faq) {
setImmediate(() => {
invalidateFaq(client, faq);

// TODO invalidate widgets here
winston.verbose("Deleting widgets cache for faq.update");
invalidateWidgets(client, faq.id_project);//tested
Expand All @@ -491,6 +494,8 @@

faqBotEvent.on("faq.delete", function(faq) {
setImmediate(() => {
invalidateFaq(client, faq);

// TODO invalidate widgets here
winston.verbose("Deleting widgets cache for faq.delete",faq);
invalidateWidgets(client, faq.id_project);//tested
Expand Down Expand Up @@ -706,6 +711,17 @@
}


function invalidateFaq(client, faq) {
key = "faqs:botid:"+faq.id_faq_kb+":faq:id:*";
winston.info("Deleting cache for faq with key: " + key);
client.del(key, function (err, reply) {
winston.debug("Deleted cache for faq",reply);
winston.info("Deleted cache for faq",{err:err});
});


}

function invalidateWidgets(client, project_id) {
key = project_id+":widgets";
winston.verbose("Deleting cache for widgets with key: " + key);
Expand Down
9 changes: 9 additions & 0 deletions routes/faq_kb.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ router.put('/:faq_kbid', function (req, res) {
update.tags = req.body.tags;
}


Faq_kb.findByIdAndUpdate(req.params.faq_kbid, update, { new: true, upsert: true }, function (err, updatedFaq_kb) {
if (err) {
return res.status(500).send({ success: false, msg: 'Error updating object.' });
Expand Down Expand Up @@ -319,6 +320,7 @@ router.delete('/:faq_kbid', function (req, res) {

winston.debug(req.body);


Faq_kb.remove({ _id: req.params.faq_kbid }, function (err, faq_kb) {
if (err) {
return res.status(500).send({ success: false, msg: 'Error deleting object.' });
Expand Down Expand Up @@ -401,6 +403,13 @@ router.get('/', function (req, res) {
query.$text = search_obj;
}

if (req.query.public) {
query.public = req.query.public;
}

if (req.query.certified) {
query.certified = req.query.certified;
}


winston.info("query", query);
Expand Down

0 comments on commit 19d72d8

Please sign in to comment.