@tiledesk/tiledesk-server 2.4.90 → 2.4.91
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +3 -0
- package/package.json +1 -1
- package/routes/faq_kb.js +5 -0
- package/test/faqkbRoute.js +33 -21
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/routes/faq_kb.js
CHANGED
@@ -988,6 +988,10 @@ router.get('/exportjson/:id_faq_kb', (req, res) => {
|
|
988
988
|
// delete from exclude map intent_id
|
989
989
|
const intents = faqs.map(({ _id, id_project, topic, status, id_faq_kb, createdBy, createdAt, updatedAt, __v, ...keepAttrs }) => keepAttrs)
|
990
990
|
|
991
|
+
if (faq_kb.attributes) {
|
992
|
+
delete faq_kb.attributes.globals;
|
993
|
+
}
|
994
|
+
|
991
995
|
let json = {
|
992
996
|
webhook_enabled: faq_kb.webhook_enabled,
|
993
997
|
webhook_url: faq_kb.webhook_url,
|
@@ -1013,6 +1017,7 @@ router.get('/exportjson/:id_faq_kb', (req, res) => {
|
|
1013
1017
|
// return res.status(200).send(json);
|
1014
1018
|
// }
|
1015
1019
|
let json_string = JSON.stringify(json);
|
1020
|
+
console.log("json_string: ", json_string)
|
1016
1021
|
res.set({ "Content-Disposition": "attachment; filename=\"bot.json\"" });
|
1017
1022
|
return res.send(json_string);
|
1018
1023
|
}
|
package/test/faqkbRoute.js
CHANGED
@@ -766,7 +766,7 @@ describe('FaqKBRoute', () => {
|
|
766
766
|
})
|
767
767
|
|
768
768
|
|
769
|
-
it('
|
769
|
+
it('exportjson', (done) => {
|
770
770
|
|
771
771
|
|
772
772
|
// this.timeout();
|
@@ -795,28 +795,40 @@ describe('FaqKBRoute', () => {
|
|
795
795
|
}
|
796
796
|
|
797
797
|
chai.request(server)
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
798
|
+
.get('/' + savedProject._id + '/faq?id_faq_kb=' + id_faq_kb)
|
799
|
+
.auth(email, pwd)
|
800
|
+
.end((err, res) => {
|
801
|
+
if (log) {
|
802
|
+
console.log("faq_list: ", res.body);
|
803
|
+
}
|
804
|
+
res.should.have.status(200);
|
805
|
+
res.body.should.be.an('array').that.is.not.empty;
|
806
|
+
|
807
|
+
chai.request(server)
|
808
|
+
.get('/' + savedProject._id + '/faq_kb/exportjson/' + id_faq_kb)
|
809
|
+
.auth(email, pwd)
|
810
|
+
.end((err, res) => {
|
811
|
+
if (log) {
|
812
|
+
console.log("export json res: ", res.body);
|
813
|
+
}
|
812
814
|
console.log("export json res: ", res.body);
|
813
|
-
|
814
|
-
|
815
|
-
|
815
|
+
res.should.have.status(200);
|
816
|
+
//res.body.should.be.a('string');
|
817
|
+
|
818
|
+
done();
|
819
|
+
})
|
820
|
+
})
|
821
|
+
|
822
|
+
// chai.request(server)
|
823
|
+
// .patch('/' + savedProject._id + '/faq_kb/' + id_faq_kb + '/attributes')
|
824
|
+
// .auth(email, pwd)
|
825
|
+
// .send({ variables: { var1: "var1", var2: "var2" }, globals: [{ key: 'test', value: 'test]'}] })
|
826
|
+
// .end((err, res) => {
|
827
|
+
// console.log("res.body: ", res.body)
|
828
|
+
|
829
|
+
|
830
|
+
// })
|
816
831
|
|
817
|
-
done();
|
818
|
-
})
|
819
|
-
})
|
820
832
|
});
|
821
833
|
});
|
822
834
|
});
|