@tiledesk/tiledesk-server 2.4.103 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-chat21-app",
3
3
  "description": "The Tiledesk Chat21 module",
4
- "version": "1.1.7",
4
+ "version": "1.1.8",
5
5
  "private": false,
6
6
  "author": "Andrea Leo - Frontiere21 SRL",
7
7
  "license": "AGPL-3.0",
@@ -11,7 +11,7 @@
11
11
  "url": "https://github.com/Tiledesk/tiledesk-server"
12
12
  },
13
13
  "dependencies": {
14
- "@chat21/chat21-node-sdk": "^1.1.7",
14
+ "@chat21/chat21-node-sdk": "^1.1.8",
15
15
  "winston": "^3.3.3",
16
16
  "firebase-admin": "^9.5.0"
17
17
  },
@@ -464,12 +464,12 @@ if (enableGoogleSignin==true) {
464
464
  },
465
465
  function(issuer, profile, cb) {
466
466
 
467
- winston.info("issuer: "+issuer)
468
- winston.info("profile", profile)
467
+ winston.debug("issuer: "+issuer)
468
+ winston.debug("profile", profile)
469
469
  // winston.info("cb", cb)
470
470
 
471
471
  var email = profile.emails[0].value;
472
- winston.info("email: "+email)
472
+ winston.debug("email: "+email)
473
473
 
474
474
  var query = {providerId : issuer, subject: profile.id};
475
475
  winston.debug("query", query)
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.4.103",
4
+ "version": "2.5.1",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@tiledesk/tiledesk-apps": "^1.0.17",
40
- "@tiledesk/tiledesk-chat21-app": "^1.1.7",
40
+ "@tiledesk/tiledesk-chat21-app": "^1.1.8",
41
41
  "@tiledesk/tiledesk-chatbot-util": "^0.8.33",
42
42
  "@tiledesk/tiledesk-dialogflow-connector": "^1.8.4",
43
43
  "@tiledesk/tiledesk-json-rules-engine": "^4.0.3",
@@ -45,7 +45,7 @@
45
45
  "@tiledesk/tiledesk-messenger-connector": "^0.1.17",
46
46
  "@tiledesk/tiledesk-rasa-connector": "^1.0.10",
47
47
  "@tiledesk/tiledesk-telegram-connector": "^0.1.10",
48
- "@tiledesk/tiledesk-tybot-connector": "^0.2.54",
48
+ "@tiledesk/tiledesk-tybot-connector": "^0.2.56",
49
49
  "@tiledesk/tiledesk-whatsapp-connector": "^0.1.63",
50
50
  "@tiledesk/tiledesk-whatsapp-jobworker": "^0.0.7",
51
51
  "@tiledesk/tiledesk-chatbot-templates": "^0.1.2",
@@ -150,6 +150,16 @@ function startWorker() {
150
150
  winston.info("Data queue", oka)
151
151
  });
152
152
 
153
+ ch.bindQueue(_ok.queue, exchange, "request_participants_join", {}, function(err3, oka) {
154
+ winston.info("Queue bind: "+_ok.queue+ " err: "+err3+ " key: request_participants_join");
155
+ winston.info("Data queue", oka)
156
+ });
157
+
158
+ ch.bindQueue(_ok.queue, exchange, "request_participants_leave", {}, function(err3, oka) {
159
+ winston.info("Queue bind: "+_ok.queue+ " err: "+err3+ " key: request_participants_leave");
160
+ winston.info("Data queue", oka)
161
+ });
162
+
153
163
  ch.bindQueue(_ok.queue, exchange, "request_update", {}, function(err3, oka) {
154
164
  winston.info("Queue bind: "+_ok.queue+ " err: "+err3+ " key: request_update");
155
165
  winston.info("Data queue", oka)
@@ -230,6 +240,19 @@ function work(msg, cb) {
230
240
  // requestEvent.emit('request.update.queue', msg.content);
231
241
  requestEvent.emit('request.update.preflight.queue', JSON.parse(message_string));
232
242
  }
243
+
244
+ if (topic === 'request_participants_join') {
245
+ winston.debug("reconnect here topic:" + topic);
246
+ // requestEvent.emit('request.update.queue', msg.content);
247
+ requestEvent.emit('request.participants.join.queue', JSON.parse(message_string));
248
+ }
249
+
250
+
251
+ if (topic === 'request_participants_leave') {
252
+ winston.debug("reconnect here topic:" + topic);
253
+ // requestEvent.emit('request.update.queue', msg.content);
254
+ requestEvent.emit('request.participants.leave.queue', JSON.parse(message_string));
255
+ }
233
256
 
234
257
  if (topic === 'request_participants_update') {
235
258
  winston.debug("reconnect here topic:" + topic);
@@ -312,8 +335,19 @@ function listen() {
312
335
  });
313
336
  });
314
337
 
338
+ requestEvent.on('request.participants.join', function(request) {
339
+ setImmediate(() => {
340
+ publish(exchange, "request_participants_join", Buffer.from(JSON.stringify(request)));
341
+ winston.debug("reconnect participants.join published")
342
+ });
343
+ });
315
344
 
316
-
345
+ requestEvent.on('request.participants.leave', function(request) {
346
+ setImmediate(() => {
347
+ publish(exchange, "request_participants_leave", Buffer.from(JSON.stringify(request)));
348
+ winston.debug("reconnect participants.leave published")
349
+ });
350
+ });
317
351
 
318
352
  requestEvent.on('request.participants.update', function(request) {
319
353
  setImmediate(() => {
@@ -41,13 +41,14 @@ class Listener {
41
41
 
42
42
 
43
43
  updateProjectUser(id_user, id_project, operation) {
44
- winston.debug("Route queue updateProjectUser start");
44
+ winston.debug("Route queue updateProjectUser start operation: " +operation+ "id_user "+ id_user + " id_project " + id_project );
45
45
  return Project_user
46
46
  .findOneAndUpdate({id_user: id_user, id_project: id_project}, {$inc : {'number_assigned_requests' : operation}}, {new: true, upsert:false}, function(err, updatedPU) {
47
47
  if (err) {
48
48
  return winston.error(err);
49
49
  }
50
50
  winston.debug("Route queue number_assigned_requests +1 :" + updatedPU.id);
51
+ winston.debug("Route queue number_assigned_requests +1 :" + updatedPU.id);
51
52
 
52
53
  updatedPU.populate({path:'id_user', select:{'firstname':1, 'lastname':1}},function (err, updatedProject_userPopulated){
53
54
 
@@ -77,7 +78,10 @@ class Listener {
77
78
  if (request.participatingAgents.length>0) {
78
79
  request.participatingAgents.forEach(user => {
79
80
  winston.debug("request.participatingAgents user",user); //it is a user and not a project_user
80
- this.updateProjectUser(user.id, request.id_project, operation);
81
+ var userid = user.id || user._id;
82
+ winston.debug("updateParticipatingProjectUsers userid: "+userid);
83
+
84
+ this.updateProjectUser(userid, request.id_project, operation);
81
85
  });
82
86
  }
83
87
  }
package/routes/request.js CHANGED
@@ -802,7 +802,7 @@ router.delete('/:requestid', function (req, res) {
802
802
  });
803
803
 
804
804
 
805
- Request.remove({ request_id: req.params.requestid }, function (err, request) {
805
+ Request.findOneAndDelete({ request_id: req.params.requestid }, function (err, request) {
806
806
  if (err) {
807
807
  winston.error('--- > ERROR ', err);
808
808
  return res.status(500).send({ success: false, msg: 'Error deleting object.' });
@@ -819,6 +819,24 @@ router.delete('/:requestid', function (req, res) {
819
819
  res.json(request);
820
820
 
821
821
  });
822
+
823
+ // Request.remove({ request_id: req.params.requestid }, function (err, request) {
824
+ // if (err) {
825
+ // winston.error('--- > ERROR ', err);
826
+ // return res.status(500).send({ success: false, msg: 'Error deleting object.' });
827
+ // }
828
+
829
+ // if (!request) {
830
+ // return res.status(404).send({ success: false, msg: 'Object not found.' });
831
+ // }
832
+
833
+ // winston.verbose('Request deleted with request_id: ' + req.params.requestid);
834
+
835
+ // requestEvent.emit('request.delete', request);
836
+
837
+ // res.json(request);
838
+
839
+ // });
822
840
  });
823
841
 
824
842