@itleanchatbot/shared-models-js-postgres 2.8.15 → 2.8.17

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itleanchatbot/shared-models-js-postgres",
3
- "version": "2.8.15",
3
+ "version": "2.8.17",
4
4
  "description": "Shared Models JS Postgres",
5
5
  "main": "index.js",
6
6
  "license": "ISC",
@@ -1,66 +1,66 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- up: async (queryInterface, Sequelize) => {
5
- await queryInterface.createTable('ApiPreRequests', {
6
- id: {
7
- allowNull: false,
8
- defaultValue: Sequelize.literal('uuid_generate_v4()'),
9
- primaryKey: true,
10
- type: Sequelize.UUID,
11
- },
12
- ApiId: {
13
- allowNull: true,
14
- defaultValue: null,
15
- type: Sequelize.UUID,
16
- references: {
17
- model: 'Apis',
18
- key: 'id',
19
- },
20
- onDelete: 'SET NULL',
21
- onUpdate: 'CASCADE',
22
- },
23
- ApiResourceId: {
24
- allowNull: true,
25
- defaultValue: null,
26
- type: Sequelize.UUID,
27
- references: {
28
- model: 'ApiResources',
29
- key: 'id',
30
- },
31
- onDelete: 'SET NULL',
32
- onUpdate: 'CASCADE',
33
- },
34
- PreApiResourceId: {
35
- allowNull: false,
36
- type: Sequelize.UUID,
37
- references: {
38
- model: 'ApiResources',
39
- key: 'id',
40
- },
41
- onDelete: 'SET NULL',
42
- onUpdate: 'CASCADE',
43
- },
44
- result: {
45
- allowNull: false,
46
- type: Sequelize.STRING,
47
- },
48
- delayForNewRequest: {
49
- allowNull: false,
50
- type: Sequelize.STRING,
51
- },
52
- createdAt: {
53
- allowNull: false,
54
- type: Sequelize.DATE,
55
- },
56
- updatedAt: {
57
- allowNull: false,
58
- type: Sequelize.DATE,
59
- },
60
- })
61
- },
62
-
63
- down: async (queryInterface) => {
64
- await queryInterface.dropTable('ApiPreRequests')
65
- }
66
- };
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ await queryInterface.createTable('ApiPreRequests', {
6
+ id: {
7
+ allowNull: false,
8
+ defaultValue: Sequelize.literal('uuid_generate_v4()'),
9
+ primaryKey: true,
10
+ type: Sequelize.UUID,
11
+ },
12
+ ApiId: {
13
+ allowNull: true,
14
+ defaultValue: null,
15
+ type: Sequelize.UUID,
16
+ references: {
17
+ model: 'Apis',
18
+ key: 'id',
19
+ },
20
+ onDelete: 'SET NULL',
21
+ onUpdate: 'CASCADE',
22
+ },
23
+ ApiResourceId: {
24
+ allowNull: true,
25
+ defaultValue: null,
26
+ type: Sequelize.UUID,
27
+ references: {
28
+ model: 'ApiResources',
29
+ key: 'id',
30
+ },
31
+ onDelete: 'SET NULL',
32
+ onUpdate: 'CASCADE',
33
+ },
34
+ PreApiResourceId: {
35
+ allowNull: false,
36
+ type: Sequelize.UUID,
37
+ references: {
38
+ model: 'ApiResources',
39
+ key: 'id',
40
+ },
41
+ onDelete: 'SET NULL',
42
+ onUpdate: 'CASCADE',
43
+ },
44
+ result: {
45
+ allowNull: false,
46
+ type: Sequelize.STRING,
47
+ },
48
+ delayForNewRequest: {
49
+ allowNull: false,
50
+ type: Sequelize.STRING,
51
+ },
52
+ createdAt: {
53
+ allowNull: false,
54
+ type: Sequelize.DATE,
55
+ },
56
+ updatedAt: {
57
+ allowNull: false,
58
+ type: Sequelize.DATE,
59
+ },
60
+ })
61
+ },
62
+
63
+ down: async (queryInterface) => {
64
+ await queryInterface.dropTable('ApiPreRequests')
65
+ }
66
+ };
@@ -1,20 +1,20 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- up: async (queryInterface, Sequelize) => {
5
- await queryInterface.addColumn('SystemUsers', 'isActive', {
6
- type: Sequelize.BOOLEAN,
7
- defaultValue: true,
8
- allowNull: false
9
- })
10
- await queryInterface.addColumn('SystemUsers', 'disabledAt', {
11
- type: Sequelize.DATE,
12
- allowNull: true
13
- })
14
- },
15
-
16
- down: async (queryInterface) => {
17
- await queryInterface.removeColumn('SystemUsers', 'isActive')
18
- await queryInterface.removeColumn('SystemUsers', 'disabledAt')
19
- }
20
- };
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ await queryInterface.addColumn('SystemUsers', 'isActive', {
6
+ type: Sequelize.BOOLEAN,
7
+ defaultValue: true,
8
+ allowNull: false
9
+ })
10
+ await queryInterface.addColumn('SystemUsers', 'disabledAt', {
11
+ type: Sequelize.DATE,
12
+ allowNull: true
13
+ })
14
+ },
15
+
16
+ down: async (queryInterface) => {
17
+ await queryInterface.removeColumn('SystemUsers', 'isActive')
18
+ await queryInterface.removeColumn('SystemUsers', 'disabledAt')
19
+ }
20
+ };
@@ -1,28 +1,28 @@
1
- 'use strict';
2
-
3
- const datesColumns = [
4
- 'processedAt', 'enqueuedAt', 'failedAt', 'readAt', 'sentAt', 'deliveredAt'
5
- ]
6
- module.exports = {
7
- async up (queryInterface, Sequelize) {
8
-
9
- await queryInterface.addColumn('BotIterables', 'brokerMessageStatus', {
10
- type: Sequelize.STRING(100),
11
- allowNull: true
12
- })
13
-
14
- for (const columnName of datesColumns) {
15
- await queryInterface.addColumn('BotIterables', columnName, {
16
- type: Sequelize.DATE,
17
- allowNull: true
18
- })
19
- }
20
- },
21
-
22
- async down (queryInterface) {
23
- await queryInterface.removeColumn('BotIterables', 'brokerStatus')
24
- for(const columnName of datesColumns) {
25
- await queryInterface.removeColumn('BotIterables', columnName)
26
- }
27
- }
28
- };
1
+ 'use strict';
2
+
3
+ const datesColumns = [
4
+ 'processedAt', 'enqueuedAt', 'failedAt', 'readAt', 'sentAt', 'deliveredAt'
5
+ ]
6
+ module.exports = {
7
+ async up (queryInterface, Sequelize) {
8
+
9
+ await queryInterface.addColumn('BotIterables', 'brokerMessageStatus', {
10
+ type: Sequelize.STRING(100),
11
+ allowNull: true
12
+ })
13
+
14
+ for (const columnName of datesColumns) {
15
+ await queryInterface.addColumn('BotIterables', columnName, {
16
+ type: Sequelize.DATE,
17
+ allowNull: true
18
+ })
19
+ }
20
+ },
21
+
22
+ async down (queryInterface) {
23
+ await queryInterface.removeColumn('BotIterables', 'brokerStatus')
24
+ for(const columnName of datesColumns) {
25
+ await queryInterface.removeColumn('BotIterables', columnName)
26
+ }
27
+ }
28
+ };
@@ -1,14 +1,14 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- async up (queryInterface, Sequelize) {
5
- await queryInterface.addColumn('Sessions', 'startedSessionAt', {
6
- type: Sequelize.DATE,
7
- allowNull: true
8
- })
9
- },
10
-
11
- async down (queryInterface) {
12
- await queryInterface.removeColumn('Sessions', 'startedSessionAt')
13
- }
14
- };
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ async up (queryInterface, Sequelize) {
5
+ await queryInterface.addColumn('Sessions', 'startedSessionAt', {
6
+ type: Sequelize.DATE,
7
+ allowNull: true
8
+ })
9
+ },
10
+
11
+ async down (queryInterface) {
12
+ await queryInterface.removeColumn('Sessions', 'startedSessionAt')
13
+ }
14
+ };
@@ -1,15 +1,15 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- up: async (queryInterface, Sequelize) => {
5
- await queryInterface.addColumn('ConversationSessions', 'isHsm', {
6
- allowNull: false,
7
- defaultValue: false,
8
- type: Sequelize.BOOLEAN,
9
- })
10
- },
11
-
12
- down: async (queryInterface) => {
13
- await queryInterface.removeColumn('ConversationSessions', 'isHsm')
14
- }
15
- };
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ await queryInterface.addColumn('ConversationSessions', 'isHsm', {
6
+ allowNull: false,
7
+ defaultValue: false,
8
+ type: Sequelize.BOOLEAN,
9
+ })
10
+ },
11
+
12
+ down: async (queryInterface) => {
13
+ await queryInterface.removeColumn('ConversationSessions', 'isHsm')
14
+ }
15
+ };
@@ -6,6 +6,7 @@ const CHANNEL_TYPES = {
6
6
  WHATSAPP_INTERAXA: 'whatsapp_interaxa',
7
7
  WHATSAPP_GUPSHUP: 'whatsapp_gupshup',
8
8
  MICROSOFT_TEAMS: 'microsoft_teams',
9
+ FACEBOOK_MESSENGER: 'facebook_messenger',
9
10
  }
10
11
 
11
12
  const ChannelTypesModel = (sequelize, DataTypes) => {
@@ -18,7 +18,6 @@ exports.model = (sequelize, DataType) => {
18
18
 
19
19
  Client.associate = (models) => {
20
20
  Client.hasMany(models.Sessions)
21
- Client.hasMany(models.ConversationSessions)
22
21
  }
23
22
 
24
23
  return Client
@@ -1,31 +1,31 @@
1
- exports.model = (sequelize, Sequelize) => {
2
- const OpenFAQs = sequelize.define('FaqQuestions', {
3
- name: {
4
- type: Sequelize.STRING(255),
5
- allowNull: false,
6
- validate: {
7
- notEmpty: true,
8
- },
9
- },
10
- OpenFAQId: {
11
- type: Sequelize.UUID,
12
- allowNull: false,
13
- references: {
14
- model: 'OpenFAQs',
15
- key: 'id',
16
- },
17
- onDelete: 'CASCADE',
18
- onUpdate: 'CASCADE',
19
- foreignKeyConstraint: true,
20
- validate: {
21
- notEmpty: true,
22
- },
23
- },
24
- })
25
-
26
- OpenFAQs.associate = (models) => {
27
- OpenFAQs.belongsTo(models.OpenFAQs)
28
- }
29
-
30
- return OpenFAQs
31
- }
1
+ exports.model = (sequelize, Sequelize) => {
2
+ const OpenFAQs = sequelize.define('FaqQuestions', {
3
+ name: {
4
+ type: Sequelize.STRING(255),
5
+ allowNull: false,
6
+ validate: {
7
+ notEmpty: true,
8
+ },
9
+ },
10
+ OpenFAQId: {
11
+ type: Sequelize.UUID,
12
+ allowNull: false,
13
+ references: {
14
+ model: 'OpenFAQs',
15
+ key: 'id',
16
+ },
17
+ onDelete: 'CASCADE',
18
+ onUpdate: 'CASCADE',
19
+ foreignKeyConstraint: true,
20
+ validate: {
21
+ notEmpty: true,
22
+ },
23
+ },
24
+ })
25
+
26
+ OpenFAQs.associate = (models) => {
27
+ OpenFAQs.belongsTo(models.OpenFAQs)
28
+ }
29
+
30
+ return OpenFAQs
31
+ }
@@ -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
+ }
@@ -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
+ }