@itleanchatbot/shared-models-js-postgres 2.8.10 → 2.8.12
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/package.json +1 -1
- package/src/migrations/20220301115430-create-sessionsPreReports.js +58 -0
- package/src/migrations/20220301115530-alter-sessions.js +14 -0
- package/src/migrations/20220303152530-create-dialogNodesPreReports.js +46 -0
- package/src/migrations/20220308145105-alter-table-transhipConversation-mimetype.js +16 -0
- package/src/models/dialogNodes.js +1 -0
- package/src/models/dialogNodesPreReports.js +35 -0
- package/src/models/sessions.js +9 -0
- package/src/models/sessionsPreReports.js +43 -0
- package/src/models/transhipConversations.js +1 -1
package/package.json
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
await queryInterface.createTable('SessionsPreReports', {
|
|
6
|
+
id: {
|
|
7
|
+
allowNull: false,
|
|
8
|
+
defaultValue: Sequelize.literal('uuid_generate_v4()'),
|
|
9
|
+
primaryKey: true,
|
|
10
|
+
type: Sequelize.UUID,
|
|
11
|
+
},
|
|
12
|
+
date: {
|
|
13
|
+
allowNull: false,
|
|
14
|
+
type: Sequelize.DATEONLY
|
|
15
|
+
},
|
|
16
|
+
ChannelId: {
|
|
17
|
+
allowNull: false,
|
|
18
|
+
type: Sequelize.UUID
|
|
19
|
+
},
|
|
20
|
+
SkillId: {
|
|
21
|
+
allowNull: false,
|
|
22
|
+
type: Sequelize.UUID
|
|
23
|
+
},
|
|
24
|
+
sessions: {
|
|
25
|
+
allowNull: false,
|
|
26
|
+
type: Sequelize.BIGINT
|
|
27
|
+
},
|
|
28
|
+
closedSessions: {
|
|
29
|
+
allowNull: false,
|
|
30
|
+
type: Sequelize.BIGINT
|
|
31
|
+
},
|
|
32
|
+
clientMessages: {
|
|
33
|
+
allowNull: false,
|
|
34
|
+
type: Sequelize.BIGINT
|
|
35
|
+
},
|
|
36
|
+
botMessages: {
|
|
37
|
+
allowNull: false,
|
|
38
|
+
type: Sequelize.BIGINT
|
|
39
|
+
},
|
|
40
|
+
totalSessionTime: {
|
|
41
|
+
allowNull: false,
|
|
42
|
+
type: Sequelize.BIGINT
|
|
43
|
+
},
|
|
44
|
+
createdAt: {
|
|
45
|
+
allowNull: false,
|
|
46
|
+
type: Sequelize.DATE,
|
|
47
|
+
},
|
|
48
|
+
updatedAt: {
|
|
49
|
+
allowNull: false,
|
|
50
|
+
type: Sequelize.DATE,
|
|
51
|
+
},
|
|
52
|
+
})
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
down: async (queryInterface, Sequelize) => {
|
|
56
|
+
await queryInterface.dropTable('SessionsPreReports')
|
|
57
|
+
}
|
|
58
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
async up (queryInterface, Sequelize) {
|
|
5
|
+
await queryInterface.addColumn('Sessions', 'SessionsPreReportId', {
|
|
6
|
+
type: Sequelize.UUID,
|
|
7
|
+
allowNull: true
|
|
8
|
+
})
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
async down (queryInterface) {
|
|
12
|
+
await queryInterface.removeColumn('Sessions', 'SessionsPreReportId')
|
|
13
|
+
}
|
|
14
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
await queryInterface.createTable('DialogNodesPreReports', {
|
|
6
|
+
id: {
|
|
7
|
+
allowNull: false,
|
|
8
|
+
defaultValue: Sequelize.literal('uuid_generate_v4()'),
|
|
9
|
+
primaryKey: true,
|
|
10
|
+
type: Sequelize.UUID,
|
|
11
|
+
},
|
|
12
|
+
date: {
|
|
13
|
+
allowNull: false,
|
|
14
|
+
type: Sequelize.DATEONLY
|
|
15
|
+
},
|
|
16
|
+
ChannelId: {
|
|
17
|
+
allowNull: false,
|
|
18
|
+
type: Sequelize.UUID
|
|
19
|
+
},
|
|
20
|
+
SkillId: {
|
|
21
|
+
allowNull: false,
|
|
22
|
+
type: Sequelize.UUID
|
|
23
|
+
},
|
|
24
|
+
DialogNodeId: {
|
|
25
|
+
allowNull: false,
|
|
26
|
+
type: Sequelize.UUID
|
|
27
|
+
},
|
|
28
|
+
quantity: {
|
|
29
|
+
allowNull: false,
|
|
30
|
+
type: Sequelize.INTEGER
|
|
31
|
+
},
|
|
32
|
+
createdAt: {
|
|
33
|
+
allowNull: false,
|
|
34
|
+
type: Sequelize.DATE,
|
|
35
|
+
},
|
|
36
|
+
updatedAt: {
|
|
37
|
+
allowNull: false,
|
|
38
|
+
type: Sequelize.DATE,
|
|
39
|
+
},
|
|
40
|
+
})
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
down: async (queryInterface, Sequelize) => {
|
|
44
|
+
await queryInterface.dropTable('DialogNodesPreReports')
|
|
45
|
+
}
|
|
46
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
module.exports = {
|
|
3
|
+
async up (queryInterface, Sequelize) {
|
|
4
|
+
await queryInterface.changeColumn('TranshipConversations', 'mimetype', {
|
|
5
|
+
type: Sequelize.STRING(255),
|
|
6
|
+
allowNull: true,
|
|
7
|
+
})
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
async down (queryInterface, Sequelize) {
|
|
11
|
+
await queryInterface.changeColumn('TranshipConversations', 'mimetype', {
|
|
12
|
+
type: Sequelize.STRING(50),
|
|
13
|
+
allowNull: true,
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -145,6 +145,7 @@ const DialogNodesModel = (sequelize, Sequelize) => {
|
|
|
145
145
|
DialogNodes.hasOne(models.EndSessionTriggers)
|
|
146
146
|
DialogNodes.hasMany(models.EndSessionTriggers, { as: 'EndSessionJumpToDialogNode', foreignKey: 'JumpToDialogNodeId' })
|
|
147
147
|
DialogNodes.hasMany(models.InactivityTriggers)
|
|
148
|
+
DialogNodes.hasMany(models.DialogNodesPreReports)
|
|
148
149
|
}
|
|
149
150
|
return DialogNodes
|
|
150
151
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
exports.model = (sequelize, DataTypes) => {
|
|
2
|
+
const DialogNodesPreReports = sequelize.define('DialogNodesPreReports', {
|
|
3
|
+
date: {
|
|
4
|
+
allowNull: false,
|
|
5
|
+
type: DataTypes.DATEONLY
|
|
6
|
+
},
|
|
7
|
+
ChannelId: {
|
|
8
|
+
allowNull: false,
|
|
9
|
+
type: DataTypes.UUID
|
|
10
|
+
},
|
|
11
|
+
SkillId: {
|
|
12
|
+
allowNull: false,
|
|
13
|
+
type: DataTypes.UUID
|
|
14
|
+
},
|
|
15
|
+
DialogNodeId: {
|
|
16
|
+
allowNull: false,
|
|
17
|
+
type: DataTypes.UUID,
|
|
18
|
+
references: {
|
|
19
|
+
model: 'DialogNodes',
|
|
20
|
+
key: 'id',
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
quantity: {
|
|
24
|
+
allowNull: false,
|
|
25
|
+
type: DataTypes.INTEGER
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
DialogNodesPreReports.associate = models => {
|
|
30
|
+
DialogNodesPreReports.belongsTo(models.DialogNodes)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return DialogNodesPreReports
|
|
34
|
+
}
|
|
35
|
+
|
package/src/models/sessions.js
CHANGED
|
@@ -55,6 +55,14 @@ exports.model = (sequelize, DataTypes) => {
|
|
|
55
55
|
startedSessionAt: {
|
|
56
56
|
allowNull: true,
|
|
57
57
|
type: DataTypes.DATE
|
|
58
|
+
},
|
|
59
|
+
SessionsPreReportId: {
|
|
60
|
+
type: DataTypes.UUID,
|
|
61
|
+
allowNull: true,
|
|
62
|
+
references: {
|
|
63
|
+
model: 'SessionsPreReports',
|
|
64
|
+
key: 'id',
|
|
65
|
+
},
|
|
58
66
|
}
|
|
59
67
|
})
|
|
60
68
|
|
|
@@ -64,6 +72,7 @@ exports.model = (sequelize, DataTypes) => {
|
|
|
64
72
|
Sessions.hasOne(models.SocketClients)
|
|
65
73
|
Sessions.hasMany(models.BotIterables)
|
|
66
74
|
Sessions.belongsTo(models.Client)
|
|
75
|
+
Sessions.belongsTo(models.SessionsPreReports)
|
|
67
76
|
}
|
|
68
77
|
|
|
69
78
|
return Sessions
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
exports.model = (sequelize, DataTypes) => {
|
|
2
|
+
const SessionsPreReports = sequelize.define('SessionsPreReports', {
|
|
3
|
+
date: {
|
|
4
|
+
allowNull: false,
|
|
5
|
+
type: DataTypes.DATEONLY
|
|
6
|
+
},
|
|
7
|
+
ChannelId: {
|
|
8
|
+
allowNull: false,
|
|
9
|
+
type: DataTypes.UUID
|
|
10
|
+
},
|
|
11
|
+
SkillId: {
|
|
12
|
+
allowNull: false,
|
|
13
|
+
type: DataTypes.UUID
|
|
14
|
+
},
|
|
15
|
+
sessions: {
|
|
16
|
+
allowNull: false,
|
|
17
|
+
type: DataTypes.BIGINT
|
|
18
|
+
},
|
|
19
|
+
closedSessions: {
|
|
20
|
+
allowNull: false,
|
|
21
|
+
type: DataTypes.BIGINT
|
|
22
|
+
},
|
|
23
|
+
clientMessages: {
|
|
24
|
+
allowNull: false,
|
|
25
|
+
type: DataTypes.BIGINT
|
|
26
|
+
},
|
|
27
|
+
botMessages: {
|
|
28
|
+
allowNull: false,
|
|
29
|
+
type: DataTypes.BIGINT
|
|
30
|
+
},
|
|
31
|
+
totalSessionTime: {
|
|
32
|
+
allowNull: false,
|
|
33
|
+
type: DataTypes.BIGINT
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
SessionsPreReports.associate = models => {
|
|
38
|
+
SessionsPreReports.hasMany(models.Sessions)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return SessionsPreReports
|
|
42
|
+
}
|
|
43
|
+
|