@itleanchatbot/shared-models-js-postgres 2.8.11 → 2.8.13

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.
@@ -1,33 +1,33 @@
1
- exports.model = (sequelize, Sequelize) => {
2
- const OpenFAQs = sequelize.define('OpenFAQs', {
3
- name: {
4
- allowNull: false,
5
- type: Sequelize.TEXT,
6
- unique: false,
7
- },
8
- SkillId: {
9
- allowNull: false,
10
- type: Sequelize.UUID,
11
- references: {
12
- model: 'Skill',
13
- key: 'id',
14
- },
15
- onDelete: 'RESTRICT',
16
- onUpdate: 'CASCADE',
17
- },
18
- answers: {
19
- allowNull: false,
20
- type: Sequelize.JSON,
21
- validate: {
22
- notEmpty: true,
23
- },
24
- },
25
- })
26
-
27
- OpenFAQs.associate = (models) => {
28
- OpenFAQs.belongsTo(models.Skill)
29
- OpenFAQs.hasMany(models.FaqQuestions)
30
- }
31
-
32
- return OpenFAQs
33
- }
1
+ exports.model = (sequelize, Sequelize) => {
2
+ const OpenFAQs = sequelize.define('OpenFAQs', {
3
+ name: {
4
+ allowNull: false,
5
+ type: Sequelize.TEXT,
6
+ unique: false,
7
+ },
8
+ SkillId: {
9
+ allowNull: false,
10
+ type: Sequelize.UUID,
11
+ references: {
12
+ model: 'Skill',
13
+ key: 'id',
14
+ },
15
+ onDelete: 'RESTRICT',
16
+ onUpdate: 'CASCADE',
17
+ },
18
+ answers: {
19
+ allowNull: false,
20
+ type: Sequelize.JSON,
21
+ validate: {
22
+ notEmpty: true,
23
+ },
24
+ },
25
+ })
26
+
27
+ OpenFAQs.associate = (models) => {
28
+ OpenFAQs.belongsTo(models.Skill)
29
+ OpenFAQs.hasMany(models.FaqQuestions)
30
+ }
31
+
32
+ return OpenFAQs
33
+ }
@@ -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
+
@@ -1,98 +1,98 @@
1
-
2
-
3
- module.exports = {
4
- up: async (queryInterface) => {
5
- const departmentPermissionId = await queryInterface.rawSelect(
6
- 'Permissions',
7
- { where: { permissionCode: 'crud_departments' } },
8
- ['id']
9
- )
10
-
11
- const subDepartmentPermissionId = await queryInterface.rawSelect(
12
- 'Permissions',
13
- { where: { permissionCode: 'crud_subDepartments' } },
14
- ['id']
15
- )
16
-
17
- const linePermissionId = await queryInterface.rawSelect(
18
- 'Permissions',
19
- { where: { permissionCode: 'crud_lines' } },
20
- ['id']
21
- )
22
-
23
- const branchPermissionId = await queryInterface.rawSelect(
24
- 'Permissions',
25
- { where: { permissionCode: 'crud_branches' } },
26
- ['id']
27
- )
28
-
29
- const adminProfileId = await queryInterface.rawSelect(
30
- 'Profiles',
31
- { where: { name: 'Administrador' } },
32
- ['id']
33
- )
34
-
35
-
36
- return queryInterface.bulkInsert('Profiles_Permissions', [
37
- {
38
- ProfileId: adminProfileId,
39
- PermissionId: departmentPermissionId,
40
- createdAt: new Date(),
41
- updatedAt: new Date(),
42
- },
43
- {
44
- ProfileId: adminProfileId,
45
- PermissionId: subDepartmentPermissionId,
46
- createdAt: new Date(),
47
- updatedAt: new Date(),
48
- },
49
- {
50
- ProfileId: adminProfileId,
51
- PermissionId: linePermissionId,
52
- createdAt: new Date(),
53
- updatedAt: new Date(),
54
- },
55
- {
56
- ProfileId: adminProfileId,
57
- PermissionId: branchPermissionId,
58
- createdAt: new Date(),
59
- updatedAt: new Date(),
60
- },
61
- ])
62
- },
63
- down: async (queryInterface) => {
64
- const departmentPermissionId = await queryInterface.rawSelect(
65
- 'Permissions',
66
- { where: { permissionCode: 'crud_departments' } },
67
- ['id']
68
- )
69
-
70
- const subDepartmentPermissionId = await queryInterface.rawSelect(
71
- 'Permissions',
72
- { where: { permissionCode: 'crud_subDepartments' } },
73
- ['id']
74
- )
75
-
76
- const linePermissionId = await queryInterface.rawSelect(
77
- 'Permissions',
78
- { where: { permissionCode: 'crud_lines' } },
79
- ['id']
80
- )
81
-
82
- const branchPermissionId = await queryInterface.rawSelect(
83
- 'Permissions',
84
- { where: { permissionCode: 'crud_branches' } },
85
- ['id']
86
- )
87
-
88
- const adminProfileId = await queryInterface.rawSelect(
89
- 'Profiles',
90
- { where: { name: 'Administrador' } },
91
- ['id']
92
- )
93
- await queryInterface.bulkDelete('Profiles_Permissions', { ProfileId: adminProfileId, PermissionId: departmentPermissionId }, {})
94
- await queryInterface.bulkDelete('Profiles_Permissions', { ProfileId: adminProfileId, PermissionId: subDepartmentPermissionId }, {})
95
- await queryInterface.bulkDelete('Profiles_Permissions', { ProfileId: adminProfileId, PermissionId: linePermissionId }, {})
96
- await queryInterface.bulkDelete('Profiles_Permissions', { ProfileId: adminProfileId, PermissionId: branchPermissionId }, {})
97
- },
98
- }
1
+
2
+
3
+ module.exports = {
4
+ up: async (queryInterface) => {
5
+ const departmentPermissionId = await queryInterface.rawSelect(
6
+ 'Permissions',
7
+ { where: { permissionCode: 'crud_departments' } },
8
+ ['id']
9
+ )
10
+
11
+ const subDepartmentPermissionId = await queryInterface.rawSelect(
12
+ 'Permissions',
13
+ { where: { permissionCode: 'crud_subDepartments' } },
14
+ ['id']
15
+ )
16
+
17
+ const linePermissionId = await queryInterface.rawSelect(
18
+ 'Permissions',
19
+ { where: { permissionCode: 'crud_lines' } },
20
+ ['id']
21
+ )
22
+
23
+ const branchPermissionId = await queryInterface.rawSelect(
24
+ 'Permissions',
25
+ { where: { permissionCode: 'crud_branches' } },
26
+ ['id']
27
+ )
28
+
29
+ const adminProfileId = await queryInterface.rawSelect(
30
+ 'Profiles',
31
+ { where: { name: 'Administrador' } },
32
+ ['id']
33
+ )
34
+
35
+
36
+ return queryInterface.bulkInsert('Profiles_Permissions', [
37
+ {
38
+ ProfileId: adminProfileId,
39
+ PermissionId: departmentPermissionId,
40
+ createdAt: new Date(),
41
+ updatedAt: new Date(),
42
+ },
43
+ {
44
+ ProfileId: adminProfileId,
45
+ PermissionId: subDepartmentPermissionId,
46
+ createdAt: new Date(),
47
+ updatedAt: new Date(),
48
+ },
49
+ {
50
+ ProfileId: adminProfileId,
51
+ PermissionId: linePermissionId,
52
+ createdAt: new Date(),
53
+ updatedAt: new Date(),
54
+ },
55
+ {
56
+ ProfileId: adminProfileId,
57
+ PermissionId: branchPermissionId,
58
+ createdAt: new Date(),
59
+ updatedAt: new Date(),
60
+ },
61
+ ])
62
+ },
63
+ down: async (queryInterface) => {
64
+ const departmentPermissionId = await queryInterface.rawSelect(
65
+ 'Permissions',
66
+ { where: { permissionCode: 'crud_departments' } },
67
+ ['id']
68
+ )
69
+
70
+ const subDepartmentPermissionId = await queryInterface.rawSelect(
71
+ 'Permissions',
72
+ { where: { permissionCode: 'crud_subDepartments' } },
73
+ ['id']
74
+ )
75
+
76
+ const linePermissionId = await queryInterface.rawSelect(
77
+ 'Permissions',
78
+ { where: { permissionCode: 'crud_lines' } },
79
+ ['id']
80
+ )
81
+
82
+ const branchPermissionId = await queryInterface.rawSelect(
83
+ 'Permissions',
84
+ { where: { permissionCode: 'crud_branches' } },
85
+ ['id']
86
+ )
87
+
88
+ const adminProfileId = await queryInterface.rawSelect(
89
+ 'Profiles',
90
+ { where: { name: 'Administrador' } },
91
+ ['id']
92
+ )
93
+ await queryInterface.bulkDelete('Profiles_Permissions', { ProfileId: adminProfileId, PermissionId: departmentPermissionId }, {})
94
+ await queryInterface.bulkDelete('Profiles_Permissions', { ProfileId: adminProfileId, PermissionId: subDepartmentPermissionId }, {})
95
+ await queryInterface.bulkDelete('Profiles_Permissions', { ProfileId: adminProfileId, PermissionId: linePermissionId }, {})
96
+ await queryInterface.bulkDelete('Profiles_Permissions', { ProfileId: adminProfileId, PermissionId: branchPermissionId }, {})
97
+ },
98
+ }
@@ -1,41 +1,41 @@
1
- 'use strict'
2
-
3
- module.exports = {
4
- up: async (queryInterface, Sequelize) => {
5
- const ibmIntelligenceId = await queryInterface.rawSelect(
6
- 'Intelligences',
7
- {
8
- where: {
9
- providerType: 'ibm',
10
- },
11
- },
12
- ['id']
13
- )
14
-
15
- const ibmProviderId = '473da11f-79c5-49a9-bce6-2f7d8ec76daf'
16
-
17
- if (ibmIntelligenceId) {
18
- await queryInterface.bulkInsert('Skills', [
19
- {
20
- id: '148d1182-9f28-4b30-8fc3-70b650672f73',
21
- IntelligenceId: ibmIntelligenceId,
22
- AwsProviderId: null,
23
- ItleanProviderId: null,
24
- IbmProviderId: ibmProviderId,
25
- name: 'Skill Seed',
26
- description: 'skill created by seeders',
27
- lang: 'pt-br',
28
- externalIbmId: '1c6e2489-6675-4c08-aa89-fdac4bc50de3',
29
- createdAt: Sequelize.literal('now()'),
30
- updatedAt: Sequelize.literal('now()'),
31
- },
32
- ])
33
- }
34
- },
35
-
36
- down: async (queryInterface) => {
37
- await queryInterface.bulkDelete('Skills', null, {
38
- id: '148d1182-9f28-4b30-8fc3-70b650672f73',
39
- })
40
- },
41
- }
1
+ 'use strict'
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ const ibmIntelligenceId = await queryInterface.rawSelect(
6
+ 'Intelligences',
7
+ {
8
+ where: {
9
+ providerType: 'ibm',
10
+ },
11
+ },
12
+ ['id']
13
+ )
14
+
15
+ const ibmProviderId = '473da11f-79c5-49a9-bce6-2f7d8ec76daf'
16
+
17
+ if (ibmIntelligenceId) {
18
+ await queryInterface.bulkInsert('Skills', [
19
+ {
20
+ id: '148d1182-9f28-4b30-8fc3-70b650672f73',
21
+ IntelligenceId: ibmIntelligenceId,
22
+ AwsProviderId: null,
23
+ ItleanProviderId: null,
24
+ IbmProviderId: ibmProviderId,
25
+ name: 'Skill Seed',
26
+ description: 'skill created by seeders',
27
+ lang: 'pt-br',
28
+ externalIbmId: '1c6e2489-6675-4c08-aa89-fdac4bc50de3',
29
+ createdAt: Sequelize.literal('now()'),
30
+ updatedAt: Sequelize.literal('now()'),
31
+ },
32
+ ])
33
+ }
34
+ },
35
+
36
+ down: async (queryInterface) => {
37
+ await queryInterface.bulkDelete('Skills', null, {
38
+ id: '148d1182-9f28-4b30-8fc3-70b650672f73',
39
+ })
40
+ },
41
+ }
@@ -1,43 +1,43 @@
1
- 'use strict'
2
-
3
- const skillId = '148d1182-9f28-4b30-8fc3-70b650672f73'
4
- const dialogNodeId = '9f023259-fd70-4724-9ab2-e11ce5555d77'
5
- const apiResourceId = '7756e862-61bc-41ee-b8ce-0b8a646c7de0'
6
- module.exports = {
7
- up: async (queryInterface, Sequelize) => {
8
- await queryInterface.bulkInsert('DialogNodes', [
9
- {
10
- id: dialogNodeId,
11
- contexts: '[]',
12
- name: 'Seeder Dialog Node',
13
- condition: 'test || test',
14
- step: '1',
15
- replayWait: true,
16
- type: 'node',
17
- isMultipleResponse: false,
18
- SkillId: skillId,
19
- JumpToDialogNodeId: null,
20
- JumpToSkillId: null,
21
- DialogNodeFolderId: null,
22
- createdAt: Sequelize.literal('now()'),
23
- updatedAt: Sequelize.literal('now()'),
24
- },
25
- ])
26
-
27
- await queryInterface.bulkInsert('DialogNodes_ApiResources', [
28
- {
29
- id: '395b05f4-e91f-445a-8be1-2ab199ea4824',
30
- DialogNodeId: dialogNodeId,
31
- ApiResourceId: apiResourceId,
32
- response: 'apiTest',
33
- createdAt: Sequelize.literal('now()'),
34
- updatedAt: Sequelize.literal('now()'),
35
- },
36
- ])
37
- },
38
-
39
- down: async (queryInterface) => {
40
- await queryInterface.bulkDelete('DialogNodes_ApiResources', null, {})
41
- await queryInterface.bulkDelete('DialogNodes', null, {})
42
- },
43
- }
1
+ 'use strict'
2
+
3
+ const skillId = '148d1182-9f28-4b30-8fc3-70b650672f73'
4
+ const dialogNodeId = '9f023259-fd70-4724-9ab2-e11ce5555d77'
5
+ const apiResourceId = '7756e862-61bc-41ee-b8ce-0b8a646c7de0'
6
+ module.exports = {
7
+ up: async (queryInterface, Sequelize) => {
8
+ await queryInterface.bulkInsert('DialogNodes', [
9
+ {
10
+ id: dialogNodeId,
11
+ contexts: '[]',
12
+ name: 'Seeder Dialog Node',
13
+ condition: 'test || test',
14
+ step: '1',
15
+ replayWait: true,
16
+ type: 'node',
17
+ isMultipleResponse: false,
18
+ SkillId: skillId,
19
+ JumpToDialogNodeId: null,
20
+ JumpToSkillId: null,
21
+ DialogNodeFolderId: null,
22
+ createdAt: Sequelize.literal('now()'),
23
+ updatedAt: Sequelize.literal('now()'),
24
+ },
25
+ ])
26
+
27
+ await queryInterface.bulkInsert('DialogNodes_ApiResources', [
28
+ {
29
+ id: '395b05f4-e91f-445a-8be1-2ab199ea4824',
30
+ DialogNodeId: dialogNodeId,
31
+ ApiResourceId: apiResourceId,
32
+ response: 'apiTest',
33
+ createdAt: Sequelize.literal('now()'),
34
+ updatedAt: Sequelize.literal('now()'),
35
+ },
36
+ ])
37
+ },
38
+
39
+ down: async (queryInterface) => {
40
+ await queryInterface.bulkDelete('DialogNodes_ApiResources', null, {})
41
+ await queryInterface.bulkDelete('DialogNodes', null, {})
42
+ },
43
+ }