@itleanchatbot/shared-models-js-postgres 3.1.8 → 3.1.10
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": "3.1.
|
|
3
|
+
"version": "3.1.10",
|
|
4
4
|
"description": "Shared Models JS Postgres",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "ISC",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"crypto-js": "^4.0.0",
|
|
42
42
|
"dotenv": "^16.0.0",
|
|
43
|
-
"moment": "^2.29.
|
|
43
|
+
"moment": "^2.29.4",
|
|
44
44
|
"pg": "^8.5.1",
|
|
45
45
|
"pg-hstore": "^2.3.3",
|
|
46
|
-
"sequelize": "^6.
|
|
46
|
+
"sequelize": "^6.29.0",
|
|
47
47
|
"sequelize-cli": "^6.4.1",
|
|
48
48
|
"uuid-apikey": "^1.5.3"
|
|
49
49
|
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
async up(queryInterface) {
|
|
5
|
-
await queryInterface.sequelize.query(`
|
|
6
|
-
CREATE INDEX IF NOT EXISTS idx_botiterables_ent_createdat
|
|
7
|
-
ON "BotIterables"("EnterpriseId", "createdAt");
|
|
8
|
-
`)
|
|
9
|
-
|
|
10
|
-
await queryInterface.sequelize.query(`
|
|
11
|
-
CREATE INDEX IF NOT EXISTS idx_botiterables_session
|
|
12
|
-
ON "BotIterables"("SessionId");
|
|
13
|
-
`)
|
|
14
|
-
|
|
15
|
-
await queryInterface.sequelize.query(`
|
|
16
|
-
CREATE INDEX IF NOT EXISTS idx_sessions_id_channel
|
|
17
|
-
ON "Sessions"(id, "ChannelId");
|
|
18
|
-
`)
|
|
19
|
-
|
|
20
|
-
await queryInterface.sequelize.query(`
|
|
21
|
-
CREATE INDEX IF NOT EXISTS idx_channels_id
|
|
22
|
-
ON "Channels"(id);
|
|
23
|
-
`)
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
async down(queryInterface) {
|
|
27
|
-
await queryInterface.sequelize.query(`
|
|
28
|
-
DROP INDEX IF EXISTS idx_botiterables_ent_createdat;
|
|
29
|
-
`)
|
|
30
|
-
await queryInterface.sequelize.query(`
|
|
31
|
-
DROP INDEX IF EXISTS idx_botiterables_session;
|
|
32
|
-
`)
|
|
33
|
-
await queryInterface.sequelize.query(`
|
|
34
|
-
DROP INDEX IF EXISTS idx_sessions_id_channel;
|
|
35
|
-
`)
|
|
36
|
-
await queryInterface.sequelize.query(`
|
|
37
|
-
DROP INDEX IF EXISTS idx_channels_id;
|
|
38
|
-
`)
|
|
39
|
-
},
|
|
40
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
async up(queryInterface) {
|
|
5
|
+
await queryInterface.sequelize.query(`
|
|
6
|
+
CREATE INDEX IF NOT EXISTS idx_botiterables_ent_createdat
|
|
7
|
+
ON "BotIterables"("EnterpriseId", "createdAt");
|
|
8
|
+
`)
|
|
9
|
+
|
|
10
|
+
await queryInterface.sequelize.query(`
|
|
11
|
+
CREATE INDEX IF NOT EXISTS idx_botiterables_session
|
|
12
|
+
ON "BotIterables"("SessionId");
|
|
13
|
+
`)
|
|
14
|
+
|
|
15
|
+
await queryInterface.sequelize.query(`
|
|
16
|
+
CREATE INDEX IF NOT EXISTS idx_sessions_id_channel
|
|
17
|
+
ON "Sessions"(id, "ChannelId");
|
|
18
|
+
`)
|
|
19
|
+
|
|
20
|
+
await queryInterface.sequelize.query(`
|
|
21
|
+
CREATE INDEX IF NOT EXISTS idx_channels_id
|
|
22
|
+
ON "Channels"(id);
|
|
23
|
+
`)
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
async down(queryInterface) {
|
|
27
|
+
await queryInterface.sequelize.query(`
|
|
28
|
+
DROP INDEX IF EXISTS idx_botiterables_ent_createdat;
|
|
29
|
+
`)
|
|
30
|
+
await queryInterface.sequelize.query(`
|
|
31
|
+
DROP INDEX IF EXISTS idx_botiterables_session;
|
|
32
|
+
`)
|
|
33
|
+
await queryInterface.sequelize.query(`
|
|
34
|
+
DROP INDEX IF EXISTS idx_sessions_id_channel;
|
|
35
|
+
`)
|
|
36
|
+
await queryInterface.sequelize.query(`
|
|
37
|
+
DROP INDEX IF EXISTS idx_channels_id;
|
|
38
|
+
`)
|
|
39
|
+
},
|
|
40
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
await queryInterface.createTable('EnterpriseSSOConfigs', {
|
|
6
|
+
id: {
|
|
7
|
+
type: Sequelize.UUID,
|
|
8
|
+
allowNull: false,
|
|
9
|
+
primaryKey: true,
|
|
10
|
+
defaultValue: Sequelize.UUIDV4,
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
EnterpriseId: {
|
|
14
|
+
type: Sequelize.UUID,
|
|
15
|
+
allowNull: false,
|
|
16
|
+
references: {
|
|
17
|
+
model: 'Enterprises',
|
|
18
|
+
key: 'id',
|
|
19
|
+
},
|
|
20
|
+
onDelete: 'CASCADE',
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
provider: {
|
|
24
|
+
type: Sequelize.ENUM('azure_saml'),
|
|
25
|
+
allowNull: false,
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
emailDomain: {
|
|
29
|
+
type: Sequelize.STRING(255),
|
|
30
|
+
allowNull: false,
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
samlIssuer: {
|
|
34
|
+
type: Sequelize.STRING,
|
|
35
|
+
allowNull: false,
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
samlIdpUrl: {
|
|
39
|
+
type: Sequelize.STRING,
|
|
40
|
+
allowNull: false,
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
samlCertificate: {
|
|
44
|
+
type: Sequelize.TEXT,
|
|
45
|
+
allowNull: false,
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
isActive: {
|
|
49
|
+
type: Sequelize.BOOLEAN,
|
|
50
|
+
defaultValue: true,
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
createdAt: {
|
|
54
|
+
allowNull: false,
|
|
55
|
+
type: Sequelize.DATE,
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
updatedAt: {
|
|
59
|
+
allowNull: false,
|
|
60
|
+
type: Sequelize.DATE,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
down: async (queryInterface, Sequelize) => {
|
|
66
|
+
await queryInterface.dropTable('EnterpriseSSOConfigs');
|
|
67
|
+
await queryInterface.sequelize.query(
|
|
68
|
+
'DROP TYPE IF EXISTS "enum_EnterpriseSSOConfigs_provider";'
|
|
69
|
+
);
|
|
70
|
+
},
|
|
71
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
module.exports.model = (sequelize, DataTypes) => {
|
|
2
|
+
const EnterpriseSSOConfigs = sequelize.define('EnterpriseSSOConfigs', {
|
|
3
|
+
id: {
|
|
4
|
+
type: DataTypes.UUID,
|
|
5
|
+
primaryKey: true,
|
|
6
|
+
defaultValue: DataTypes.UUIDV4,
|
|
7
|
+
allowNull: false,
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
EnterpriseId: {
|
|
11
|
+
type: DataTypes.UUID,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
provider: {
|
|
16
|
+
type: DataTypes.ENUM('azure_saml'),
|
|
17
|
+
allowNull: false,
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
emailDomain: {
|
|
21
|
+
type: DataTypes.STRING(255),
|
|
22
|
+
allowNull: false,
|
|
23
|
+
comment: 'Domínio usado para discovery (ex: empresa.com.br)',
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
samlIssuer: {
|
|
27
|
+
type: DataTypes.STRING,
|
|
28
|
+
allowNull: false,
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
samlIdpUrl: {
|
|
32
|
+
type: DataTypes.STRING,
|
|
33
|
+
allowNull: false,
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
samlCertificate: {
|
|
37
|
+
type: DataTypes.TEXT,
|
|
38
|
+
allowNull: false,
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
isActive: {
|
|
42
|
+
type: DataTypes.BOOLEAN,
|
|
43
|
+
defaultValue: true,
|
|
44
|
+
},
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
EnterpriseSSOConfigs.associate = (models) => {
|
|
48
|
+
EnterpriseSSOConfigs.belongsTo(models.Enterprises, {
|
|
49
|
+
foreignKey: 'EnterpriseId',
|
|
50
|
+
onDelete: 'CASCADE',
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
EnterpriseSSOConfigs._repository = EnterpriseSSOConfigs
|
|
55
|
+
|
|
56
|
+
return EnterpriseSSOConfigs
|
|
57
|
+
}
|
|
@@ -74,6 +74,7 @@ exports.model = (sequelize, DataTypes) => {
|
|
|
74
74
|
Enterprises.hasMany(models.BotIterables)
|
|
75
75
|
Enterprises.hasMany(models.BlacklistContacts)
|
|
76
76
|
Enterprises.hasMany(models.WhitelistContacts)
|
|
77
|
+
Enterprises.hasOne(models.EnterpriseSSOConfigs)
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
return Enterprises
|