@tiledesk/tiledesk-server 2.13.50 → 2.13.52
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 +8 -0
- package/app.js +2 -1
- package/event/requestEvent.js +1 -0
- package/jobs.js +2 -1
- package/jobsManager.js +6 -1
- package/models/analyticResult.js +10 -1
- package/package.json +1 -1
- package/pubmodules/emailNotification/requestNotification.js +6 -2
- package/pubmodules/messageActions/messageActionsInterceptor.js +3 -1
- package/pubmodules/queue/reconnect.js +15 -3
- package/pubmodules/queue/reconnectFanout.js +4 -0
- package/pubmodules/rules/conciergeBot.js +3 -1
- package/pubmodules/trigger/rulesTrigger.js +12 -4
- package/routes/kb.js +6 -3
- package/routes/request.js +24 -0
- package/routes/user-request.js +3 -0
- package/services/requestService.js +392 -813
- package/services/subscriptionNotifier.js +12 -1
- package/services/updateRequestSnapshotQueued.js +71 -0
- package/test/messageRoute.js +12 -12
- package/test/requestRoute.js +46 -44
- package/test/requestService.js +84 -84
- package/test/webhookRoute.js +1 -1
|
@@ -27,6 +27,13 @@ var webhook_origin = process.env.WEBHOOK_ORIGIN || "http://localhost:3000";
|
|
|
27
27
|
winston.debug("webhook_origin: "+webhook_origin);
|
|
28
28
|
|
|
29
29
|
|
|
30
|
+
var SUBSCRIPTION_LOG_ENABLED = false;
|
|
31
|
+
if (process.env.SUBSCRIPTION_LOG_ENABLED==true || process.env.SUBSCRIPTION_LOG_ENABLED=="true") {
|
|
32
|
+
SUBSCRIPTION_LOG_ENABLED = true;
|
|
33
|
+
}
|
|
34
|
+
winston.info("SUBSCRIPTION_LOG_ENABLED: "+SUBSCRIPTION_LOG_ENABLED);
|
|
35
|
+
|
|
36
|
+
|
|
30
37
|
var request = require('retry-request', {
|
|
31
38
|
request: require('request')
|
|
32
39
|
});
|
|
@@ -124,6 +131,8 @@ class SubscriptionNotifier {
|
|
|
124
131
|
winston.debug("SubscriptionLog response", response);
|
|
125
132
|
winston.debug("SubscriptionLog jsonResponse", jsonResponse);
|
|
126
133
|
|
|
134
|
+
if (SUBSCRIPTION_LOG_ENABLED==true) {
|
|
135
|
+
|
|
127
136
|
var subscriptionLog = new SubscriptionLog({event: s.event, target: s.target,
|
|
128
137
|
response: JSON.stringify(response),
|
|
129
138
|
body: JSON.stringify(jsonResponse),
|
|
@@ -137,7 +146,9 @@ class SubscriptionNotifier {
|
|
|
137
146
|
}
|
|
138
147
|
winston.debug("SubscriptionLog saved", sl);
|
|
139
148
|
});
|
|
140
|
-
|
|
149
|
+
|
|
150
|
+
}
|
|
151
|
+
|
|
141
152
|
if (err) {
|
|
142
153
|
winston.error("Error sending webhook for event " + s.event + " TO " + s.target + " with error " , err);
|
|
143
154
|
if (callback) {
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Request = require("../models/request");
|
|
4
|
+
const requestEvent = require('../event/requestEvent');
|
|
5
|
+
var winston = require('../config/winston');
|
|
6
|
+
|
|
7
|
+
class UpdateRequestSnapshotQueued {
|
|
8
|
+
|
|
9
|
+
constructor() {
|
|
10
|
+
// this.listen();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
listen() {
|
|
14
|
+
this.updateRequestSnapshot();
|
|
15
|
+
winston.info("Listening UpdateRequestSnapshotQueued started")
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
updateRequestSnapshot() {
|
|
19
|
+
var snapshotUpdateKey = 'request.snapshot.update';
|
|
20
|
+
if (requestEvent.queueEnabled) {
|
|
21
|
+
snapshotUpdateKey = 'request.snapshot.update.queue';
|
|
22
|
+
}
|
|
23
|
+
winston.debug("snapshotUpdateKey: " + snapshotUpdateKey);
|
|
24
|
+
|
|
25
|
+
requestEvent.on(snapshotUpdateKey, function (data) {
|
|
26
|
+
setImmediate(() => {
|
|
27
|
+
winston.debug("updateRequestSnapshot on request.snapshot.update ", data);
|
|
28
|
+
|
|
29
|
+
var request = data.request;
|
|
30
|
+
var snapshot = data.snapshot;
|
|
31
|
+
|
|
32
|
+
if (!request || !request.request_id || !request.id_project) {
|
|
33
|
+
winston.error("updateRequestSnapshot: Invalid request data", data);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!snapshot || Object.keys(snapshot).length === 0) {
|
|
38
|
+
winston.debug("updateRequestSnapshot: Empty snapshot, skipping update");
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var query = { request_id: request.request_id, id_project: request.id_project };
|
|
43
|
+
winston.debug("updateRequestSnapshot query ", query);
|
|
44
|
+
|
|
45
|
+
Request.findOneAndUpdate(
|
|
46
|
+
query,
|
|
47
|
+
{ "$set": { "snapshot": snapshot } },
|
|
48
|
+
{ new: true },
|
|
49
|
+
function (err, updatedRequest) {
|
|
50
|
+
if (err) {
|
|
51
|
+
winston.error("Error updating request snapshot updateRequestSnapshot", err);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (updatedRequest) {
|
|
55
|
+
winston.debug("updateRequestSnapshot updated request " + updatedRequest.request_id);
|
|
56
|
+
requestEvent.emit('request.update.snapshot', { request: updatedRequest, snapshot: snapshot });
|
|
57
|
+
} else {
|
|
58
|
+
winston.warn("updateRequestSnapshot: Request not found for " + request.request_id);
|
|
59
|
+
}
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var updateRequestSnapshotQueued = new UpdateRequestSnapshotQueued();
|
|
69
|
+
|
|
70
|
+
module.exports = updateRequestSnapshotQueued;
|
|
71
|
+
|
package/test/messageRoute.js
CHANGED
|
@@ -70,7 +70,7 @@ describe('MessageRoute', () => {
|
|
|
70
70
|
expect(res.body.request.createdBy).to.equal(savedUser._id.toString());
|
|
71
71
|
// expect(res.body.request.messages_count).to.equal(1);
|
|
72
72
|
expect(res.body.request.status).to.equal(200);
|
|
73
|
-
expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
73
|
+
//expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
74
74
|
expect(res.body.request.participants.length).to.equal(1);
|
|
75
75
|
expect(res.body.request.department).to.not.equal(null);
|
|
76
76
|
expect(res.body.request.lead).to.not.equal(null);
|
|
@@ -186,7 +186,7 @@ describe('MessageRoute', () => {
|
|
|
186
186
|
expect(res.body.request.createdBy).to.equal(savedUser._id.toString());
|
|
187
187
|
// expect(res.body.request.messages_count).to.equal(1);
|
|
188
188
|
expect(res.body.request.status).to.equal(200);
|
|
189
|
-
expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
189
|
+
//expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
190
190
|
expect(res.body.request.participants.length).to.equal(1);
|
|
191
191
|
expect(res.body.request.department).to.not.equal(null);
|
|
192
192
|
expect(res.body.request.lead).to.not.equal(null);
|
|
@@ -264,7 +264,7 @@ describe('MessageRoute', () => {
|
|
|
264
264
|
expect(res.body.request.createdBy).to.equal(savedUser._id.toString());
|
|
265
265
|
// expect(res.body.request.messages_count).to.equal(1);
|
|
266
266
|
expect(res.body.request.status).to.equal(200);
|
|
267
|
-
expect(res.body.request.snapshot.agents.length).to.equal(2);
|
|
267
|
+
//expect(res.body.request.snapshot.agents.length).to.equal(2);
|
|
268
268
|
expect(res.body.request.participants.length).to.equal(1);
|
|
269
269
|
expect(res.body.request.department).to.not.equal(null);
|
|
270
270
|
expect(res.body.request.lead).to.not.equal(null);
|
|
@@ -340,7 +340,7 @@ describe('MessageRoute', () => {
|
|
|
340
340
|
expect(res.body.request.createdBy).to.equal(savedUser._id.toString());
|
|
341
341
|
// expect(res.body.request.messages_count).to.equal(1);
|
|
342
342
|
expect(res.body.request.status).to.equal(200);
|
|
343
|
-
expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
343
|
+
//expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
344
344
|
expect(res.body.request.participants.length).to.equal(1);
|
|
345
345
|
expect(res.body.request.department).to.not.equal(null);
|
|
346
346
|
expect(res.body.request.lead).to.not.equal(null);
|
|
@@ -509,7 +509,7 @@ describe('MessageRoute', () => {
|
|
|
509
509
|
expect(res.body.request.createdBy).to.equal(savedUser._id.toString());
|
|
510
510
|
// expect(res.body.request.messages_count).to.equal(1);
|
|
511
511
|
expect(res.body.request.status).to.equal(200);
|
|
512
|
-
expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
512
|
+
//expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
513
513
|
expect(res.body.request.participants.length).to.equal(1);
|
|
514
514
|
expect(res.body.request.department).to.not.equal(undefined);
|
|
515
515
|
expect(res.body.request.lead).to.not.equal(null);
|
|
@@ -564,7 +564,7 @@ describe('MessageRoute', () => {
|
|
|
564
564
|
expect(res.body.request.createdBy).to.equal(savedUser._id.toString());
|
|
565
565
|
// expect(res.body.request.messages_count).to.equal(1);
|
|
566
566
|
expect(res.body.request.status).to.equal(200);
|
|
567
|
-
expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
567
|
+
//expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
568
568
|
expect(res.body.request.participants.length).to.equal(1);
|
|
569
569
|
expect(res.body.request.department).to.not.equal(null);
|
|
570
570
|
expect(res.body.request.lead).to.not.equal(null);
|
|
@@ -618,7 +618,7 @@ describe('MessageRoute', () => {
|
|
|
618
618
|
expect(res.body.request.createdBy).to.equal(savedUser._id.toString());
|
|
619
619
|
// expect(res.body.request.messages_count).to.equal(1);
|
|
620
620
|
expect(res.body.request.status).to.equal(200);
|
|
621
|
-
expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
621
|
+
//expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
622
622
|
expect(res.body.request.participants.length).to.equal(1);
|
|
623
623
|
expect(res.body.request.participants[0]).to.equal(savedUser._id.toString());
|
|
624
624
|
if (log) { console.log("res.body.request.participatingAgents[0]", JSON.stringify(res.body.request.participatingAgents[0])); }
|
|
@@ -677,7 +677,7 @@ describe('MessageRoute', () => {
|
|
|
677
677
|
expect(res.body.request.createdBy).to.equal(savedUser._id.toString());
|
|
678
678
|
// expect(res.body.request.messages_count).to.equal(1);
|
|
679
679
|
expect(res.body.request.status).to.equal(200);
|
|
680
|
-
expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
680
|
+
//expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
681
681
|
expect(res.body.request.participants.length).to.equal(1);
|
|
682
682
|
expect(res.body.request.department).to.not.equal(null);
|
|
683
683
|
expect(res.body.request.lead).to.not.equal(null);
|
|
@@ -732,7 +732,7 @@ describe('MessageRoute', () => {
|
|
|
732
732
|
expect(res.body.request.createdBy).to.equal(savedUser._id.toString());
|
|
733
733
|
// expect(res.body.request.messages_count).to.equal(1);
|
|
734
734
|
expect(res.body.request.status).to.equal(200);
|
|
735
|
-
expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
735
|
+
//expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
736
736
|
expect(res.body.request.participants.length).to.equal(1);
|
|
737
737
|
expect(res.body.request.department).to.not.equal(null);
|
|
738
738
|
expect(res.body.request.lead).to.not.equal(null);
|
|
@@ -1206,7 +1206,7 @@ describe('MessageRoute', () => {
|
|
|
1206
1206
|
expect(res.body.request.createdBy).to.equal(externalUserId);
|
|
1207
1207
|
// expect(res.body.request.messages_count).to.equal(1);
|
|
1208
1208
|
expect(res.body.request.status).to.equal(200);
|
|
1209
|
-
expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
1209
|
+
//expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
1210
1210
|
expect(res.body.request.participants.length).to.equal(1);
|
|
1211
1211
|
expect(res.body.request.department).to.not.equal(null);
|
|
1212
1212
|
expect(res.body.request.lead).to.not.equal(null);
|
|
@@ -1317,7 +1317,7 @@ describe('MessageRoute', () => {
|
|
|
1317
1317
|
expect(res.body.request.createdBy).to.equal(externalUserId);
|
|
1318
1318
|
// expect(res.body.request.messages_count).to.equal(1);
|
|
1319
1319
|
expect(res.body.request.status).to.equal(200);
|
|
1320
|
-
expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
1320
|
+
//expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
1321
1321
|
expect(res.body.request.participants.length).to.equal(1);
|
|
1322
1322
|
expect(res.body.request.department).to.not.equal(null);
|
|
1323
1323
|
expect(res.body.request.lead).to.not.equal(null);
|
|
@@ -1442,7 +1442,7 @@ describe('MessageRoute', () => {
|
|
|
1442
1442
|
expect(res.body.request.createdBy).to.equal(userId);
|
|
1443
1443
|
// expect(res.body.request.messages_count).to.equal(1);
|
|
1444
1444
|
expect(res.body.request.status).to.equal(200);
|
|
1445
|
-
expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
1445
|
+
//expect(res.body.request.snapshot.agents.length).to.equal(1);
|
|
1446
1446
|
expect(res.body.request.participants.length).to.equal(1);
|
|
1447
1447
|
expect(res.body.request.department).to.not.equal(null);
|
|
1448
1448
|
expect(res.body.request.lead).to.not.equal(null);
|
package/test/requestRoute.js
CHANGED
|
@@ -51,7 +51,7 @@ describe('RequestRoute', () => {
|
|
|
51
51
|
res.should.have.status(200);
|
|
52
52
|
res.body.should.be.a('object');
|
|
53
53
|
|
|
54
|
-
expect(res.body.snapshot.agents.length).to.equal(1);
|
|
54
|
+
//expect(res.body.snapshot.agents.length).to.equal(1);
|
|
55
55
|
// res.body.should.have.property('request_id').eql('request_id');
|
|
56
56
|
// res.body.should.have.property('requester_id').eql('requester_id');
|
|
57
57
|
res.body.should.have.property('first_text').eql('first_text');
|
|
@@ -63,7 +63,7 @@ describe('RequestRoute', () => {
|
|
|
63
63
|
res.body.should.have.property('status').eql(200);
|
|
64
64
|
|
|
65
65
|
// res.body.should.have.property('agents').eql(savedUser._id);
|
|
66
|
-
expect(res.body.snapshot.agents.length).to.equal(1);
|
|
66
|
+
//expect(res.body.snapshot.agents.length).to.equal(1);
|
|
67
67
|
expect(res.body.participants.length).to.equal(1);
|
|
68
68
|
|
|
69
69
|
expect(res.body.participantsAgents.length).to.equal(1);
|
|
@@ -209,7 +209,7 @@ describe('RequestRoute', () => {
|
|
|
209
209
|
res.should.have.status(200);
|
|
210
210
|
res.body.should.be.a('object');
|
|
211
211
|
|
|
212
|
-
expect(res.body.snapshot.agents.length).to.equal(1);
|
|
212
|
+
//expect(res.body.snapshot.agents.length).to.equal(1);
|
|
213
213
|
// res.body.should.have.property('request_id').eql('request_id');
|
|
214
214
|
// res.body.should.have.property('requester_id').eql('requester_id');
|
|
215
215
|
res.body.should.have.property('first_text').eql('first_text');
|
|
@@ -221,7 +221,7 @@ describe('RequestRoute', () => {
|
|
|
221
221
|
res.body.should.have.property('status').eql(200);
|
|
222
222
|
|
|
223
223
|
// res.body.should.have.property('agents').eql(savedUser._id);
|
|
224
|
-
expect(res.body.snapshot.agents.length).to.equal(1);
|
|
224
|
+
//expect(res.body.snapshot.agents.length).to.equal(1);
|
|
225
225
|
expect(res.body.participants.length).to.equal(1);
|
|
226
226
|
|
|
227
227
|
expect(res.body.participantsAgents.length).to.equal(1);
|
|
@@ -287,7 +287,7 @@ describe('RequestRoute', () => {
|
|
|
287
287
|
expect(res.body.requester._id).to.not.equal(savedProjectAndPU.project_user._id);
|
|
288
288
|
expect(res.body.requester.isAuthenticated).to.equal(true);
|
|
289
289
|
|
|
290
|
-
expect(res.body.snapshot.agents).to.equal(undefined);
|
|
290
|
+
//expect(res.body.snapshot.agents).to.equal(undefined);
|
|
291
291
|
|
|
292
292
|
done();
|
|
293
293
|
});
|
|
@@ -358,7 +358,7 @@ describe('RequestRoute', () => {
|
|
|
358
358
|
expect(res.body.participantsBots).to.have.lengthOf(1);
|
|
359
359
|
expect(res.body.hasBot).to.equal(true);
|
|
360
360
|
|
|
361
|
-
expect(res.body.snapshot.agents).to.equal(undefined);
|
|
361
|
+
//expect(res.body.snapshot.agents).to.equal(undefined);
|
|
362
362
|
expect(res.body.department.hasBot).to.equal(true);
|
|
363
363
|
|
|
364
364
|
done();
|
|
@@ -439,13 +439,13 @@ describe('RequestRoute', () => {
|
|
|
439
439
|
expect(res.body.requests[0].participantsAgents.length).to.equal(1);
|
|
440
440
|
expect(res.body.requests[0].participantsBots).to.have.lengthOf(0);
|
|
441
441
|
expect(res.body.requests[0].hasBot).to.equal(false);
|
|
442
|
-
expect(res.body.requests[0].snapshot).to.not.equal(undefined);
|
|
443
|
-
expect(res.body.requests[0].snapshot.department.name).to.not.equal(null);
|
|
442
|
+
// expect(res.body.requests[0].snapshot).to.not.equal(undefined);
|
|
443
|
+
// expect(res.body.requests[0].snapshot.department.name).to.not.equal(null);
|
|
444
444
|
// expect(res.body.requests[0].snapshot.agents.length).to.equal(1);
|
|
445
|
-
expect(res.body.requests[0].snapshot.availableAgentsCount).to.equal(1);
|
|
446
|
-
expect(res.body.requests[0].snapshot.lead.fullname).to.equal("leadfullname");
|
|
447
|
-
expect(res.body.requests[0].snapshot.requester.role).to.equal("owner");
|
|
448
|
-
expect(res.body.requests[0].snapshot.agents).to.equal(undefined);
|
|
445
|
+
// expect(res.body.requests[0].snapshot.availableAgentsCount).to.equal(1);
|
|
446
|
+
// expect(res.body.requests[0].snapshot.lead.fullname).to.equal("leadfullname");
|
|
447
|
+
// expect(res.body.requests[0].snapshot.requester.role).to.equal("owner");
|
|
448
|
+
// expect(res.body.requests[0].snapshot.agents).to.equal(undefined);
|
|
449
449
|
|
|
450
450
|
// expect(res.body.requests[0].participatingAgents.length).to.equal(1);
|
|
451
451
|
// expect(res.body.requests[0].participatingBots.length).to.equal(0);
|
|
@@ -518,9 +518,9 @@ describe('RequestRoute', () => {
|
|
|
518
518
|
expect(res.body.requests[0].participantsBots).to.have.lengthOf(0);
|
|
519
519
|
expect(res.body.requests[0].hasBot).to.equal(false);
|
|
520
520
|
|
|
521
|
-
expect(res.body.requests[0].snapshot).to.not.equal(undefined);
|
|
522
|
-
expect(res.body.requests[0].snapshot.department.name).to.not.equal(null);
|
|
523
|
-
expect(res.body.requests[0].snapshot.agents).to.equal(undefined);
|
|
521
|
+
// expect(res.body.requests[0].snapshot).to.not.equal(undefined);
|
|
522
|
+
// expect(res.body.requests[0].snapshot.department.name).to.not.equal(null);
|
|
523
|
+
// expect(res.body.requests[0].snapshot.agents).to.equal(undefined);
|
|
524
524
|
// expect(res.body.requests[0].snapshot.agents.length).to.equal(1);
|
|
525
525
|
// expect(res.body.requests[0].test).to.not.equal(undefined);
|
|
526
526
|
// expect(res.body.requests[0].participatingAgents.length).to.equal(1);
|
|
@@ -602,13 +602,13 @@ describe('RequestRoute', () => {
|
|
|
602
602
|
expect(res.body.requests[0].participantsAgents.length).to.equal(1);
|
|
603
603
|
expect(res.body.requests[0].participantsBots).to.have.lengthOf(0);
|
|
604
604
|
expect(res.body.requests[0].hasBot).to.equal(false);
|
|
605
|
-
expect(res.body.requests[0].snapshot).to.not.equal(undefined);
|
|
606
|
-
expect(res.body.requests[0].snapshot.department.name).to.not.equal(null);
|
|
605
|
+
// expect(res.body.requests[0].snapshot).to.not.equal(undefined);
|
|
606
|
+
// expect(res.body.requests[0].snapshot.department.name).to.not.equal(null);
|
|
607
607
|
// expect(res.body.requests[0].snapshot.agents.length).to.equal(1);
|
|
608
|
-
expect(res.body.requests[0].snapshot.availableAgentsCount).to.equal(1);
|
|
609
|
-
expect(res.body.requests[0].snapshot.lead.fullname).to.equal("leadfullname");
|
|
610
|
-
expect(res.body.requests[0].snapshot.requester.role).to.equal("owner");
|
|
611
|
-
expect(res.body.requests[0].snapshot.agents).to.equal(undefined);
|
|
608
|
+
// expect(res.body.requests[0].snapshot.availableAgentsCount).to.equal(1);
|
|
609
|
+
// expect(res.body.requests[0].snapshot.lead.fullname).to.equal("leadfullname");
|
|
610
|
+
// expect(res.body.requests[0].snapshot.requester.role).to.equal("owner");
|
|
611
|
+
// expect(res.body.requests[0].snapshot.agents).to.equal(undefined);
|
|
612
612
|
// expect(res.body.requests[0].participatingAgents.length).to.equal(1);
|
|
613
613
|
// expect(res.body.requests[0].participatingBots.length).to.equal(0);
|
|
614
614
|
done();
|
|
@@ -687,13 +687,13 @@ describe('RequestRoute', () => {
|
|
|
687
687
|
expect(res.body.requests[0].participantsAgents.length).to.equal(1);
|
|
688
688
|
expect(res.body.requests[0].participantsBots).to.have.lengthOf(0);
|
|
689
689
|
expect(res.body.requests[0].hasBot).to.equal(false);
|
|
690
|
-
expect(res.body.requests[0].snapshot).to.not.equal(undefined);
|
|
691
|
-
expect(res.body.requests[0].snapshot.department.name).to.not.equal(null);
|
|
690
|
+
// expect(res.body.requests[0].snapshot).to.not.equal(undefined);
|
|
691
|
+
// expect(res.body.requests[0].snapshot.department.name).to.not.equal(null);
|
|
692
692
|
// expect(res.body.requests[0].snapshot.agents.length).to.equal(1);
|
|
693
|
-
expect(res.body.requests[0].snapshot.availableAgentsCount).to.equal(1);
|
|
694
|
-
expect(res.body.requests[0].snapshot.lead.fullname).to.equal("leadfullname");
|
|
695
|
-
expect(res.body.requests[0].snapshot.requester.role).to.equal("owner");
|
|
696
|
-
expect(res.body.requests[0].snapshot.agents).to.equal(undefined);
|
|
693
|
+
// expect(res.body.requests[0].snapshot.availableAgentsCount).to.equal(1);
|
|
694
|
+
// expect(res.body.requests[0].snapshot.lead.fullname).to.equal("leadfullname");
|
|
695
|
+
// expect(res.body.requests[0].snapshot.requester.role).to.equal("owner");
|
|
696
|
+
// expect(res.body.requests[0].snapshot.agents).to.equal(undefined);
|
|
697
697
|
// expect(res.body.requests[0].participatingAgents.length).to.equal(1);
|
|
698
698
|
// expect(res.body.requests[0].participatingBots.length).to.equal(0);
|
|
699
699
|
done();
|
|
@@ -772,14 +772,14 @@ describe('RequestRoute', () => {
|
|
|
772
772
|
expect(res.body.requests[0].participantsAgents.length).to.equal(1);
|
|
773
773
|
expect(res.body.requests[0].participantsBots).to.have.lengthOf(0);
|
|
774
774
|
expect(res.body.requests[0].hasBot).to.equal(false);
|
|
775
|
-
expect(res.body.requests[0].snapshot).to.not.equal(undefined);
|
|
776
|
-
expect(res.body.requests[0].snapshot.department.name).to.not.equal(null);
|
|
775
|
+
// expect(res.body.requests[0].snapshot).to.not.equal(undefined);
|
|
776
|
+
// expect(res.body.requests[0].snapshot.department.name).to.not.equal(null);
|
|
777
777
|
// expect(res.body.requests[0].snapshot.agents.length).to.equal(1);
|
|
778
|
-
expect(res.body.requests[0].snapshot.availableAgentsCount).to.equal(1);
|
|
779
|
-
expect(res.body.requests[0].snapshot.lead.fullname).to.equal("leadfullname");
|
|
780
|
-
expect(res.body.requests[0].snapshot.requester.role).to.equal("owner");
|
|
778
|
+
// expect(res.body.requests[0].snapshot.availableAgentsCount).to.equal(1);
|
|
779
|
+
// expect(res.body.requests[0].snapshot.lead.fullname).to.equal("leadfullname");
|
|
780
|
+
// expect(res.body.requests[0].snapshot.requester.role).to.equal("owner");
|
|
781
781
|
|
|
782
|
-
expect(res.body.requests[0].snapshot.agents).to.equal(undefined);
|
|
782
|
+
// expect(res.body.requests[0].snapshot.agents).to.equal(undefined);
|
|
783
783
|
// expect(res.body.requests[0].participatingAgents.length).to.equal(1);
|
|
784
784
|
// expect(res.body.requests[0].participatingBots.length).to.equal(0);
|
|
785
785
|
done();
|
|
@@ -881,7 +881,7 @@ describe('RequestRoute', () => {
|
|
|
881
881
|
expect(res.body.requests[0].department).to.not.equal(null);
|
|
882
882
|
expect(res.body.requests[0].lead).to.not.equal(null);
|
|
883
883
|
|
|
884
|
-
|
|
884
|
+
//.agents).to.equal(undefined);
|
|
885
885
|
|
|
886
886
|
done();
|
|
887
887
|
});
|
|
@@ -1279,7 +1279,7 @@ describe('RequestRoute', () => {
|
|
|
1279
1279
|
res.should.have.status(200);
|
|
1280
1280
|
res.body.should.be.a('object');
|
|
1281
1281
|
|
|
1282
|
-
expect(res.body.snapshot.agents.length).to.equal(1);
|
|
1282
|
+
//expect(res.body.snapshot.agents.length).to.equal(1);
|
|
1283
1283
|
// res.body.should.have.property('request_id').eql('request_id');
|
|
1284
1284
|
// res.body.should.have.property('requester_id').eql('requester_id');
|
|
1285
1285
|
res.body.should.have.property('first_text').eql('first_text');
|
|
@@ -1291,7 +1291,7 @@ describe('RequestRoute', () => {
|
|
|
1291
1291
|
res.body.should.have.property('status').eql(200);
|
|
1292
1292
|
|
|
1293
1293
|
// res.body.should.have.property('agents').eql(savedUser._id);
|
|
1294
|
-
expect(res.body.snapshot.agents.length).to.equal(1);
|
|
1294
|
+
//expect(res.body.snapshot.agents.length).to.equal(1);
|
|
1295
1295
|
expect(res.body.participants.length).to.equal(1);
|
|
1296
1296
|
|
|
1297
1297
|
expect(res.body.participantsAgents.length).to.equal(1);
|
|
@@ -1311,7 +1311,7 @@ describe('RequestRoute', () => {
|
|
|
1311
1311
|
.end(function (err, res2) {
|
|
1312
1312
|
|
|
1313
1313
|
if (err) { console.error("err: ", err); }
|
|
1314
|
-
if (log) { console.log("res.body",
|
|
1314
|
+
if (log) { console.log("res.body", res2.body); }
|
|
1315
1315
|
|
|
1316
1316
|
res2.should.have.status(200);
|
|
1317
1317
|
res2.body.should.be.a('object');
|
|
@@ -1360,7 +1360,7 @@ describe('RequestRoute', () => {
|
|
|
1360
1360
|
res.should.have.status(200);
|
|
1361
1361
|
res.body.should.be.a('object');
|
|
1362
1362
|
|
|
1363
|
-
expect(res.body.snapshot.agents.length).to.equal(1);
|
|
1363
|
+
//expect(res.body.snapshot.agents.length).to.equal(1);
|
|
1364
1364
|
// res.body.should.have.property('request_id').eql('request_id');
|
|
1365
1365
|
// res.body.should.have.property('requester_id').eql('requester_id');
|
|
1366
1366
|
res.body.should.have.property('first_text').eql('first_text');
|
|
@@ -1372,7 +1372,7 @@ describe('RequestRoute', () => {
|
|
|
1372
1372
|
res.body.should.have.property('status').eql(200);
|
|
1373
1373
|
|
|
1374
1374
|
// res.body.should.have.property('agents').eql(savedUser._id);
|
|
1375
|
-
expect(res.body.snapshot.agents.length).to.equal(1);
|
|
1375
|
+
//expect(res.body.snapshot.agents.length).to.equal(1);
|
|
1376
1376
|
expect(res.body.participants.length).to.equal(1);
|
|
1377
1377
|
|
|
1378
1378
|
expect(res.body.participantsAgents.length).to.equal(1);
|
|
@@ -1402,8 +1402,10 @@ describe('RequestRoute', () => {
|
|
|
1402
1402
|
|
|
1403
1403
|
// expect(res.body.snapshot.agents).to.equal(undefined);
|
|
1404
1404
|
|
|
1405
|
-
|
|
1406
|
-
res2.body.
|
|
1405
|
+
// no_populated disabled for route() method in RequestService.js
|
|
1406
|
+
//res2.body.requester.should.be.a('string');
|
|
1407
|
+
//res2.body.lead.should.be.a('string');
|
|
1408
|
+
|
|
1407
1409
|
// expect(res.body.requester).to.equal(undefined);
|
|
1408
1410
|
// expect(res.body.lead).to.equal(undefined);
|
|
1409
1411
|
|
|
@@ -1440,7 +1442,7 @@ describe('RequestRoute', () => {
|
|
|
1440
1442
|
res.should.have.status(200);
|
|
1441
1443
|
res.body.should.be.a('object');
|
|
1442
1444
|
|
|
1443
|
-
expect(res.body.snapshot.agents.length).to.equal(1);
|
|
1445
|
+
//expect(res.body.snapshot.agents.length).to.equal(1);
|
|
1444
1446
|
// res.body.should.have.property('request_id').eql('request_id');
|
|
1445
1447
|
// res.body.should.have.property('requester_id').eql('requester_id');
|
|
1446
1448
|
res.body.should.have.property('first_text').eql('first_text');
|
|
@@ -1452,7 +1454,7 @@ describe('RequestRoute', () => {
|
|
|
1452
1454
|
res.body.should.have.property('status').eql(200);
|
|
1453
1455
|
|
|
1454
1456
|
// res.body.should.have.property('agents').eql(savedUser._id);
|
|
1455
|
-
expect(res.body.snapshot.agents.length).to.equal(1);
|
|
1457
|
+
//expect(res.body.snapshot.agents.length).to.equal(1);
|
|
1456
1458
|
expect(res.body.participants.length).to.equal(1);
|
|
1457
1459
|
|
|
1458
1460
|
expect(res.body.participantsAgents.length).to.equal(1);
|
|
@@ -1557,7 +1559,7 @@ describe('RequestRoute', () => {
|
|
|
1557
1559
|
expect(res.body.hasBot).to.equal(false);
|
|
1558
1560
|
winston.info("res.body.attributes.abandoned_by_project_users", res.body.attributes.abandoned_by_project_users);
|
|
1559
1561
|
expect(res.body.attributes.abandoned_by_project_users[savedProjectAndPU.project_user._id]).to.not.equal(undefined);
|
|
1560
|
-
expect(res.body.snapshot.agents).to.equal(undefined);
|
|
1562
|
+
//expect(res.body.snapshot.agents).to.equal(undefined);
|
|
1561
1563
|
|
|
1562
1564
|
res.body.should.have.property('department').not.eql(null);
|
|
1563
1565
|
// res.body.should.have.property('lead').eql(undefined);
|