@tiledesk/tiledesk-server 3.1.0 → 3.2.1
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 +13 -0
- package/models/dataTable.js +16 -0
- package/models/location.js +6 -12
- package/models/request.js +65 -61
- package/package.json +3 -3
- package/routes/dataTable.js +23 -0
- package/services/dataTableService.js +436 -42
- package/test/dataTablesRoute.test.js +639 -0
- package/utils/dataTableUtils.js +99 -9
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@
|
|
|
5
5
|
🚀 IN PRODUCTION 🚀
|
|
6
6
|
(https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
|
|
7
7
|
|
|
8
|
+
# 3.2.1
|
|
9
|
+
- Bump version `tiledesk-chatbot-template` to 0.1.7
|
|
10
|
+
- Bump verion `tiledesk-vxml-connector` to 0.2.7
|
|
11
|
+
- Data Tables: new `ttl` column type. The column holds the number of seconds a row stays alive and the service mirrors it into the top level `expireAt` date carried by a MongoDB TTL index, so expired rows are removed by the database itself. Only one ttl column per table; the value must be a positive integer not above 31536000 (one year), anything else answers 400
|
|
12
|
+
- `expireAt` is always `updatedAt` plus the ttl, so it measures idle time and not total lifetime: every change to a row renews its deadline, including an update that leaves the ttl column alone. A row carrying no ttl value has no `expireAt` and never expires
|
|
13
|
+
- Changing the schema realigns the rows: turning a column into `ttl` backfills `expireAt` from the numbers already stored (values that are not numeric are left without a deadline), while changing the type away from `ttl` or deleting the column removes `expireAt` from every row
|
|
14
|
+
- The TTL index on `tablerows.expireAt` is created at boot even when `MONGOOSE_AUTOINDEX` is off; without it the rows keep an `expireAt` that nothing honours and never expire. MongoDB sweeps expired documents about once a minute, so a row can outlive its deadline by up to a minute
|
|
15
|
+
- New `POST /:projectid/tables/:id/rows/insert` inserts several rows in one request, body `{ data: [ {row}, … ] }`. The whole batch is validated before anything is written, so an invalid row answers 400 instead of leaving a partial insert behind
|
|
16
|
+
- New `PUT /:projectid/tables/:id/rows/upsert` updates or inserts several rows in one request. Same body as `row/upsert` with `data` holding an array: the `conditions` name the columns that identify a row and the value to match is taken from each row of the batch, so a `value` written in the conditions is ignored. A row that carries no value for a match column answers 400 before any write, and conditions matching more than one row answer 409
|
|
17
|
+
- Both bulk endpoints accept at most `MAX_BULK_ROWS` rows per request (default 100)
|
|
18
|
+
- Fixed `PUT /:projectid/tables/:id/row/update` by conditions answering `[]` even though the rows had been written: the response was read back with the same filter used to select them, which no longer matched when the update rewrote the very field the conditions select on
|
|
19
|
+
- `stats.rows` and `stats.sizeBytes` of a table are now accurate. `GET /tables` and `GET /tables/:id` recompute them for the tables owning a ttl column, which the database empties without telling the service; renaming or deleting a column recomputes them as well, since both rewrite every row; and the version key is counted when a row is inserted, which before made the counters drift below zero on a table with enough churn
|
|
20
|
+
|
|
8
21
|
# 3.1.0
|
|
9
22
|
- Request visibility no longer embeds the project's agents in every request. `snapshot.agents` (full `project_user` documents) is no longer written; new requests store `snapshot.visibility`, `snapshot.agentIds` and `snapshot.visibilitySince`. Legacy requests keep working through `snapshot.agents`, which is removed on the next reroute
|
|
10
23
|
- Department with a group (`id_group`, or several groups in `department.groups`): visible to the active members of all configured groups, not only the group chosen for assignment. Department without groups: visible to the teammates who had joined the project when the request was routed (`visibilitySince`)
|
package/models/dataTable.js
CHANGED
|
@@ -47,11 +47,16 @@ const TableRowSchema = new Schema({
|
|
|
47
47
|
type: Schema.Types.Mixed,
|
|
48
48
|
default: {}
|
|
49
49
|
},
|
|
50
|
+
expireAt: {
|
|
51
|
+
type: Date
|
|
52
|
+
},
|
|
50
53
|
}, {
|
|
51
54
|
timestamps: true
|
|
52
55
|
});
|
|
53
56
|
|
|
54
57
|
TableRowSchema.index({ id_project: 1, id_table: 1 });
|
|
58
|
+
TableRowSchema.index({ expireAt: 1 }, { expireAfterSeconds: 0 });
|
|
59
|
+
|
|
55
60
|
|
|
56
61
|
const Table = mongoose.model('Table', TableSchema);
|
|
57
62
|
const TableRow = mongoose.model('TableRow', TableRowSchema);
|
|
@@ -61,4 +66,15 @@ if (process.env.MONGOOSE_SYNCINDEX) {
|
|
|
61
66
|
winston.verbose('TableRow syncIndexes');
|
|
62
67
|
}
|
|
63
68
|
|
|
69
|
+
// Created explicitly because MONGOOSE_AUTOINDEX can be off: without this index
|
|
70
|
+
// rows keep an expireAt that nothing ever honours, and they silently never expire.
|
|
71
|
+
TableRow.collection
|
|
72
|
+
.createIndex({ expireAt: 1 }, { expireAfterSeconds: 0 })
|
|
73
|
+
.then(function () {
|
|
74
|
+
winston.verbose('TableRow expireAt TTL index ensured');
|
|
75
|
+
})
|
|
76
|
+
.catch(function (err) {
|
|
77
|
+
winston.error('TableRow expireAt TTL index not created, rows will never expire: ', err);
|
|
78
|
+
});
|
|
79
|
+
|
|
64
80
|
module.exports = { Table, TableRow };
|
package/models/location.js
CHANGED
|
@@ -5,33 +5,27 @@ var winston = require('../config/winston');
|
|
|
5
5
|
var LocationSchema = new Schema({
|
|
6
6
|
country: {
|
|
7
7
|
type: String,
|
|
8
|
-
required: false
|
|
9
|
-
index: true
|
|
8
|
+
required: false
|
|
10
9
|
},
|
|
11
10
|
city: {
|
|
12
11
|
type: String,
|
|
13
|
-
required: false
|
|
14
|
-
index: true
|
|
12
|
+
required: false
|
|
15
13
|
},
|
|
16
14
|
streetAddress: {
|
|
17
15
|
type: String,
|
|
18
|
-
required: false
|
|
19
|
-
index: true
|
|
16
|
+
required: false
|
|
20
17
|
},
|
|
21
18
|
region: {
|
|
22
19
|
type: String,
|
|
23
|
-
required: false
|
|
24
|
-
index: true
|
|
20
|
+
required: false
|
|
25
21
|
},
|
|
26
22
|
zipcode: {
|
|
27
23
|
type: String,
|
|
28
|
-
required: false
|
|
29
|
-
index: true
|
|
24
|
+
required: false
|
|
30
25
|
},
|
|
31
26
|
ipAddress: {
|
|
32
27
|
type: String,
|
|
33
|
-
required: false
|
|
34
|
-
index: true
|
|
28
|
+
required: false
|
|
35
29
|
},
|
|
36
30
|
// https://mongoosejs.com/docs/geojson.html
|
|
37
31
|
geometry: {
|
package/models/request.js
CHANGED
|
@@ -52,8 +52,8 @@ var RequestSchema = new Schema({
|
|
|
52
52
|
// TODO attiva solo condizionalmente per performance
|
|
53
53
|
ticket_id: {
|
|
54
54
|
type: Number,
|
|
55
|
-
// required: true
|
|
56
|
-
index: true
|
|
55
|
+
// required: true
|
|
56
|
+
// index: true //Deprecated indexes
|
|
57
57
|
},
|
|
58
58
|
// The user who is asking for support through a ticket is the requester. For most businesses that use Tiledesk Support, the requester is a customer, but requesters can also be agents in your Tiledesk Support instance. requester: {
|
|
59
59
|
requester: {
|
|
@@ -108,14 +108,14 @@ var RequestSchema = new Schema({
|
|
|
108
108
|
|
|
109
109
|
preflight: {
|
|
110
110
|
type: Boolean,
|
|
111
|
-
default: false
|
|
112
|
-
index:true
|
|
111
|
+
default: false
|
|
112
|
+
// index: true //Deprecated indexes
|
|
113
113
|
},
|
|
114
114
|
|
|
115
115
|
hasBot: {
|
|
116
116
|
type: Boolean,
|
|
117
|
-
default: false
|
|
118
|
-
index:true
|
|
117
|
+
default: false
|
|
118
|
+
// index: true //Deprecated indexes
|
|
119
119
|
},
|
|
120
120
|
|
|
121
121
|
// The admin the conversation is currently assigned to.
|
|
@@ -127,14 +127,14 @@ var RequestSchema = new Schema({
|
|
|
127
127
|
|
|
128
128
|
participants: { //TODO trasformare in objectid di tipo project_user
|
|
129
129
|
type: Array,
|
|
130
|
-
required: false
|
|
131
|
-
index: true
|
|
130
|
+
required: false
|
|
131
|
+
// index: true //Deprecated indexes
|
|
132
132
|
},
|
|
133
133
|
|
|
134
134
|
priority: {
|
|
135
135
|
type: String,
|
|
136
|
-
index: true,
|
|
137
136
|
default: "medium" //translate on client side
|
|
137
|
+
// index: true //Deprecated indexes
|
|
138
138
|
},
|
|
139
139
|
|
|
140
140
|
followers: [{
|
|
@@ -153,8 +153,8 @@ var RequestSchema = new Schema({
|
|
|
153
153
|
},
|
|
154
154
|
department: {
|
|
155
155
|
type: Schema.Types.ObjectId,
|
|
156
|
-
ref: 'department'
|
|
157
|
-
index: true
|
|
156
|
+
ref: 'department'
|
|
157
|
+
// index: true //Deprecated indexes
|
|
158
158
|
// required: true
|
|
159
159
|
},
|
|
160
160
|
|
|
@@ -202,9 +202,15 @@ var RequestSchema = new Schema({
|
|
|
202
202
|
type: Number
|
|
203
203
|
},
|
|
204
204
|
|
|
205
|
-
tags:
|
|
205
|
+
tags: {
|
|
206
|
+
type: [TagSchema],
|
|
207
|
+
excludeIndexes: true //Deprecated indexes
|
|
208
|
+
},
|
|
206
209
|
|
|
207
|
-
notes:
|
|
210
|
+
notes: {
|
|
211
|
+
type: [NoteSchema],
|
|
212
|
+
excludeIndexes: true //Deprecated indexes
|
|
213
|
+
},
|
|
208
214
|
|
|
209
215
|
rating: {
|
|
210
216
|
type: Number,
|
|
@@ -270,13 +276,13 @@ var RequestSchema = new Schema({
|
|
|
270
276
|
},
|
|
271
277
|
location: LocationSchema,
|
|
272
278
|
auto_close: {
|
|
273
|
-
type: Number
|
|
274
|
-
index: true
|
|
279
|
+
type: Number
|
|
280
|
+
// index: true //Deprecated indexes
|
|
275
281
|
},
|
|
276
282
|
id_project: {
|
|
277
283
|
type: String,
|
|
278
|
-
required: true
|
|
279
|
-
index: true
|
|
284
|
+
required: true
|
|
285
|
+
// index: true //Deprecated indexes
|
|
280
286
|
},
|
|
281
287
|
smartAssignment: {
|
|
282
288
|
type: Boolean,
|
|
@@ -289,13 +295,13 @@ var RequestSchema = new Schema({
|
|
|
289
295
|
// winston.info("smartAssignment default return true");
|
|
290
296
|
return true;
|
|
291
297
|
}
|
|
292
|
-
}
|
|
293
|
-
index: true
|
|
298
|
+
}
|
|
299
|
+
// index: true //Deprecated indexes
|
|
294
300
|
},
|
|
295
301
|
workingStatus: { //new, pending, open
|
|
296
302
|
type: String,
|
|
297
|
-
required: false
|
|
298
|
-
index: true
|
|
303
|
+
required: false
|
|
304
|
+
// index: true //Deprecated indexes
|
|
299
305
|
},
|
|
300
306
|
createdBy: {
|
|
301
307
|
type: String,
|
|
@@ -303,8 +309,8 @@ var RequestSchema = new Schema({
|
|
|
303
309
|
},
|
|
304
310
|
draft: {
|
|
305
311
|
type: Boolean,
|
|
306
|
-
required: false
|
|
307
|
-
index: true
|
|
312
|
+
required: false
|
|
313
|
+
// index: true //Deprecated indexes
|
|
308
314
|
},
|
|
309
315
|
contact: ContactSchema,
|
|
310
316
|
}, {
|
|
@@ -446,13 +452,12 @@ RequestSchema.method("getBotId", function () {
|
|
|
446
452
|
|
|
447
453
|
// https://docs.mongodb.com/manual/indexes/
|
|
448
454
|
// For a single-field index and sort operations, the sort order (i.e. ascending or descending) of the index key does not matter because MongoDB can traverse the index in either direction.
|
|
449
|
-
RequestSchema.index({ createdAt: -1 }); // schema level
|
|
450
|
-
RequestSchema.index({ updatedAt: -1 }); // schema level
|
|
451
|
-
RequestSchema.index({ id_project: 1 }); // schema level
|
|
452
455
|
// https://stackoverflow.com/questions/27179664/error-when-using-a-text-index-on-mongodb/27180032
|
|
456
|
+
// { request_id, id_project } is the lookup used by messages, websocket and updates.
|
|
457
|
+
// The planner picks this over the unique request_id index when both fields are in the query.
|
|
453
458
|
RequestSchema.index({ id_project: 1, request_id: 1 }
|
|
454
459
|
// , { unique: true }
|
|
455
|
-
);
|
|
460
|
+
);
|
|
456
461
|
|
|
457
462
|
// https://docs.mongodb.com/manual/core/index-text/
|
|
458
463
|
// https://docs.mongodb.com/manual/tutorial/specify-language-for-text-index/
|
|
@@ -464,61 +469,60 @@ RequestSchema.index({ id_project: 1, request_id: 1 }
|
|
|
464
469
|
RequestSchema.index({id_project: 1, transcript: 'text', rating_message: 'text', subject: 'text', "tags.tag": 'text', "notes.text": 'text', "snapshot.lead.email": 'text', "snapshot.lead.fullname": 'text' },
|
|
465
470
|
{"name":"request_fulltext","default_language": defaultFullTextLanguage,"language_override": "dummy"}); // schema level
|
|
466
471
|
|
|
467
|
-
// let query = {id_project: operatorSelectedEvent.id_project, participants: { $exists: true, $ne: [] }};
|
|
468
|
-
RequestSchema.index({ id_project: 1, participants: 1});
|
|
469
|
-
|
|
470
|
-
// https://docs.mongodb.com/manual/core/index-compound/ The order of the fields listed in a compound index is important. The index will contain references to documents sorted first by the values of the item field and, within each value of the item field, sorted by values of the stock field. See Sort Order for more information
|
|
471
|
-
RequestSchema.index({ id_project: 1, status: 1, updatedAt: -1 }); // query for websocket
|
|
472
|
-
RequestSchema.index({ id_project: 1, status: 1, preflight:1, updatedAt: -1 }); // query for websocket
|
|
473
|
-
RequestSchema.index({ id_project: 1, preflight:1, updatedAt: -1 }); // used query ws (topic.endsWith('/requests'))
|
|
474
|
-
|
|
475
|
-
RequestSchema.index({ hasBot: 1, createdAt: 1 }); // suggested by atlas
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
// suggested by atlas
|
|
479
|
-
RequestSchema.index({ lead: 1, id_project: 1, participants: 1, preflight: 1, createdAt: -1 });
|
|
480
472
|
// suggested by atlas
|
|
481
473
|
RequestSchema.index({ lead: 1, id_project: 1, preflight: 1, createdAt: -1 });
|
|
482
474
|
|
|
483
|
-
// suggested by atlas
|
|
484
|
-
RequestSchema.index({ lead: 1, "snapshot.agents.id_user": 1, id_project: 1, preflight: 1, createdAt: -1 });
|
|
485
475
|
// Same lead query for the new visibility shape. One key per request, not per agent.
|
|
486
476
|
RequestSchema.index({ lead: 1, "snapshot.agentIds": 1, id_project: 1, preflight: 1, createdAt: -1 });
|
|
487
477
|
RequestSchema.index({ lead: 1, "snapshot.visibility": 1, "snapshot.visibilitySince": 1, id_project: 1, preflight: 1, createdAt: -1 });
|
|
488
478
|
|
|
489
|
-
|
|
490
479
|
// suggested by atlas
|
|
491
480
|
RequestSchema.index({ id_project: 1, ticket_id: 1 });
|
|
492
481
|
|
|
493
|
-
//
|
|
494
|
-
RequestSchema.index({ id_project: 1, createdAt: 1, preflight: 1});
|
|
495
|
-
|
|
496
|
-
//suggested by atlas profiler. Used by auto closing requests
|
|
497
|
-
RequestSchema.index({ hasBot: 1, status: 1, createdAt: 1});
|
|
498
|
-
|
|
499
|
-
// suggested by atlas
|
|
482
|
+
// Widget history filtered by channel. Chosen only when channel.name is an equality.
|
|
500
483
|
RequestSchema.index({ "channel.name": 1, id_project: 1, preflight: 1, "snapshot.requester.uuid_user": 1, createdAt: - 1, status: 1 })
|
|
501
484
|
RequestSchema.index({ id_project: 1, preflight: 1, "snapshot.agents.id_user": 1, updatedAt: -1, draft: 1, status: 1 })
|
|
502
485
|
// Inbox and websocket for the new visibility shape. One key per request, not per agent.
|
|
503
486
|
RequestSchema.index({ id_project: 1, preflight: 1, "snapshot.agentIds": 1, updatedAt: -1, draft: 1, status: 1 })
|
|
504
487
|
RequestSchema.index({ id_project: 1, preflight: 1, "snapshot.visibility": 1, "snapshot.visibilitySince": 1, updatedAt: -1, draft: 1, status: 1 })
|
|
505
488
|
RequestSchema.index({ id_project: 1, participants: 1, preflight: 1, updatedAt: -1, draft: 1, status: 1 })
|
|
489
|
+
// Websocket /requests: equality on id_project + preflight, sort updatedAt. Status and draft stay residual.
|
|
490
|
+
RequestSchema.index({ id_project: 1, preflight:1, updatedAt: -1 });
|
|
506
491
|
RequestSchema.index({ id_project: 1, preflight: 1, updatedAt: -1, draft: 1, status: 1 })
|
|
507
492
|
RequestSchema.index({ id_project: 1, preflight: 1, "snapshot.requester.uuid_user": 1, createdAt: -1, status: 1 })
|
|
508
|
-
|
|
493
|
+
// ?dept_id= on the request list: department + id_project + preflight, then createdAt.
|
|
494
|
+
RequestSchema.index({ department: 1, id_project: 1, preflight: 1, createdAt: -1, status: 1 })
|
|
509
495
|
RequestSchema.index({ id_project: 1, preflight: 1, createdAt: -1, status: 1 });
|
|
510
|
-
RequestSchema.index({ id_project: 1, preflight: 1, createdAt: 1 })
|
|
511
|
-
RequestSchema.index({ participants: 1, id_project: 1, createdAt: -1, status: 1 })
|
|
512
496
|
RequestSchema.index({ id_project: 1, "snapshot.lead.email": 1, createdAt: -1, status: 1 })
|
|
513
497
|
RequestSchema.index({ id_project: 1, createdAt: -1, status: 1 })
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
RequestSchema.index({
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
RequestSchema.index({
|
|
498
|
+
// List and history when status is an equality (or $in) and the sort is createdAt.
|
|
499
|
+
RequestSchema.index({ id_project: 1, status: 1, createdAt: -1 });
|
|
500
|
+
// Round-robin in departmentService: { id_project, hasBot:false, preflight:false, status:{$gt:100} } sort _id desc.
|
|
501
|
+
RequestSchema.index({ id_project: 1, hasBot: 1, preflight: 1, _id: -1, status: 1 });
|
|
502
|
+
// Routing queue: count of open chats per agent.
|
|
503
|
+
RequestSchema.index({ id_project: 1, participantsAgents: 1, status: 1, draft: 1 });
|
|
504
|
+
|
|
505
|
+
RequestSchema.index({ status: 1, hasBot: 1, updatedAt: 1 }) // For closing unresponsive requests. Hinted by the close tasks.
|
|
506
|
+
|
|
507
|
+
//Deprecated indexes
|
|
508
|
+
//RequestSchema.index({ createdAt: -1 }); // schema level
|
|
509
|
+
//RequestSchema.index({ updatedAt: -1 }); // schema level
|
|
510
|
+
//RequestSchema.index({ id_project: 1 }); // schema level
|
|
511
|
+
//RequestSchema.index({ id_project: 1, participants: 1});
|
|
512
|
+
//RequestSchema.index({ id_project: 1, status: 1, updatedAt: -1 }); // query for websocket
|
|
513
|
+
//RequestSchema.index({ id_project: 1, status: 1, preflight:1, updatedAt: -1 }); // query for websocket
|
|
514
|
+
//RequestSchema.index({ hasBot: 1, createdAt: 1 }); // suggested by atlas
|
|
515
|
+
//RequestSchema.index({ lead: 1, id_project: 1, participants: 1, preflight: 1, createdAt: -1 });
|
|
516
|
+
//RequestSchema.index({ lead: 1, "snapshot.agents.id_user": 1, id_project: 1, preflight: 1, createdAt: -1 });
|
|
517
|
+
//RequestSchema.index({ id_project: 1, createdAt: 1, preflight: 1});
|
|
518
|
+
//RequestSchema.index({ hasBot: 1, status: 1, createdAt: 1}); // old auto-close on createdAt; live jobs hint status+hasBot+updatedAt
|
|
519
|
+
//RequestSchema.index({ department: 1, id_project: 1, participants: 1, preflight: 1, createdAt: -1, status: 1 })
|
|
520
|
+
//RequestSchema.index({ id_project: 1, preflight: 1, createdAt: 1 })
|
|
521
|
+
//RequestSchema.index({ participants: 1, id_project: 1, createdAt: -1, status: 1 })
|
|
522
|
+
//RequestSchema.index({ id_project: 1, preflight: 1, smartAssignment: 1, "snapshot.department.routing": 1, createdAt: 1, status: 1 })
|
|
523
|
+
//RequestSchema.index({ status: 1, hasBot: 1, workingStatus: 1, updatedAt: 1 }) // close tasks hint the index without workingStatus
|
|
524
|
+
//RequestSchema.index({ id_project: 1, 'contact.phone': 1 }); // phone filter is an unanchored regex
|
|
525
|
+
//RequestSchema.index({ id_project: 1, 'contact.email': 1 });
|
|
522
526
|
|
|
523
527
|
// ERROR DURING DEPLOY OF 2.10.27
|
|
524
528
|
//RequestSchema.index({ id_project: 1, participants: 1, "snapshot.agents.id_user": 1, createdAt: -1, status: 1 })
|
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": "3.1
|
|
4
|
+
"version": "3.2.1",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "node ./bin/www",
|
|
7
7
|
"quota-restore": "node ./bin/quota-restore",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@tiledesk/tiledesk-apps": "^1.0.28",
|
|
42
42
|
"@tiledesk/tiledesk-chat21-app": "^1.1.8",
|
|
43
|
-
"@tiledesk/tiledesk-chatbot-templates": "^0.1.
|
|
43
|
+
"@tiledesk/tiledesk-chatbot-templates": "^0.1.7",
|
|
44
44
|
"@tiledesk/tiledesk-chatbot-util": "^0.8.33",
|
|
45
45
|
"@tiledesk/tiledesk-client": "^0.10.10",
|
|
46
46
|
"@tiledesk/tiledesk-dialogflow-connector": "^1.8.4",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@tiledesk/tiledesk-telegram-connector": "^0.1.14",
|
|
54
54
|
"@tiledesk/tiledesk-tybot-connector": "^3.0.2",
|
|
55
55
|
"@tiledesk/tiledesk-voice-twilio-connector": "^0.3.2",
|
|
56
|
-
"@tiledesk/tiledesk-vxml-connector": "^0.
|
|
56
|
+
"@tiledesk/tiledesk-vxml-connector": "^0.2.7",
|
|
57
57
|
"@tiledesk/tiledesk-whatsapp-connector": "1.0.31",
|
|
58
58
|
"@tiledesk/tiledesk-whatsapp-jobworker": "^0.0.14",
|
|
59
59
|
"amqplib": "^0.5.5",
|
package/routes/dataTable.js
CHANGED
|
@@ -171,6 +171,16 @@ router.post('/:id/row/insert', async function (req, res) {
|
|
|
171
171
|
}
|
|
172
172
|
});
|
|
173
173
|
|
|
174
|
+
router.post('/:id/rows/insert', async function (req, res) {
|
|
175
|
+
try {
|
|
176
|
+
const rows = await dataTableService.insertRowsByBody(req.projectid, req.params.id, req.body);
|
|
177
|
+
if (!rows) return res.status(404).send({ success: false, error: 'Table not found' });
|
|
178
|
+
res.status(200).send(rows);
|
|
179
|
+
} catch (err) {
|
|
180
|
+
handleError(res, err, 'inserting rows');
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
|
|
174
184
|
router.put('/:id/row/update', async function (req, res) {
|
|
175
185
|
try {
|
|
176
186
|
const row = await dataTableService.updateRowByBody(req.projectid, req.params.id, req.body);
|
|
@@ -195,6 +205,19 @@ router.put('/:id/row/upsert', async function (req, res) {
|
|
|
195
205
|
}
|
|
196
206
|
});
|
|
197
207
|
|
|
208
|
+
router.put('/:id/rows/upsert', async function (req, res) {
|
|
209
|
+
try {
|
|
210
|
+
const rows = await dataTableService.upsertRowsByBody(req.projectid, req.params.id, req.body);
|
|
211
|
+
if (rows === null) return res.status(404).send({ success: false, error: 'Table not found' });
|
|
212
|
+
res.status(200).send(rows);
|
|
213
|
+
} catch (err) {
|
|
214
|
+
if (err.message === 'Multiple rows match the conditions') {
|
|
215
|
+
return res.status(409).send({ success: false, message: err.message });
|
|
216
|
+
}
|
|
217
|
+
handleError(res, err, 'upserting rows');
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
|
|
198
221
|
router.put('/:id/row/delete', async function (req, res) {
|
|
199
222
|
try {
|
|
200
223
|
const row = await dataTableService.deleteRowByBody(req.projectid, req.params.id, req.body);
|