@itleanchatbot/shared-models-js-postgres 1.0.18 → 1.0.20

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/src/files.js CHANGED
@@ -1,35 +1,35 @@
1
- exports.FilesModel = (sequelize, DataTypes) => {
2
- const Files = sequelize.define('Files', {
3
- EnterpriseId: {
4
- type: DataTypes.UUID,
5
- allowNull: false,
6
- references: {
7
- model: 'Enterprises',
8
- key: 'id',
9
- },
10
- onDelete: 'RESTRICT',
11
- onUpdate: 'CASCADE',
12
- },
13
- base64: {
14
- type: DataTypes.TEXT,
15
- allowNull: false,
16
- validate: {
17
- notEmpty: true,
18
- },
19
- },
20
- type: {
21
- type: DataTypes.TEXT,
22
- allowNull: false,
23
- validate: {
24
- notEmpty: true,
25
- },
26
- },
27
- })
28
-
29
- Files.associate = models => {
30
- Files.belongsTo(models.Enterprises)
31
- Files.hasOne(models.Channels)
32
- }
33
-
34
- return Files
35
- }
1
+ exports.FilesModel = (sequelize, DataTypes) => {
2
+ const Files = sequelize.define('Files', {
3
+ EnterpriseId: {
4
+ type: DataTypes.UUID,
5
+ allowNull: false,
6
+ references: {
7
+ model: 'Enterprises',
8
+ key: 'id',
9
+ },
10
+ onDelete: 'RESTRICT',
11
+ onUpdate: 'CASCADE',
12
+ },
13
+ base64: {
14
+ type: DataTypes.TEXT,
15
+ allowNull: false,
16
+ validate: {
17
+ notEmpty: true,
18
+ },
19
+ },
20
+ type: {
21
+ type: DataTypes.TEXT,
22
+ allowNull: false,
23
+ validate: {
24
+ notEmpty: true,
25
+ },
26
+ },
27
+ })
28
+
29
+ Files.associate = models => {
30
+ Files.belongsTo(models.Enterprises)
31
+ Files.hasOne(models.Channels)
32
+ }
33
+
34
+ return Files
35
+ }
@@ -1,62 +1,62 @@
1
- exports.IbmProviderModel = (sequelize, types) => {
2
- const IbmProvider = sequelize.define('IbmProvider', {
3
- url: {
4
- type: types.STRING,
5
- allowNull: false,
6
- validate: {
7
- notEmpty: true,
8
- },
9
- },
10
-
11
- token: {
12
- type: types.STRING,
13
- allowNull: false,
14
- validate: {
15
- notEmpty: true,
16
- },
17
- },
18
-
19
- active: {
20
- type: types.BOOLEAN,
21
- defaultValue: true,
22
- },
23
-
24
- IntelligenceId: {
25
- type: types.UUID,
26
- allowNull: false,
27
- validate: {
28
- notEmpty: true,
29
- },
30
- },
31
-
32
- EnterpriseId: {
33
- type: types.UUID,
34
- allowNull: true,
35
- references: {
36
- model: 'Enterprises',
37
- key: 'id',
38
- },
39
- onDelete: 'RESTRICT',
40
- onUpdate: 'CASCADE',
41
- },
42
-
43
- version: {
44
- type: types.STRING(15),
45
- allowNull: false,
46
- defaultValue: '2018-09-20',
47
- },
48
-
49
- apiVersion: {
50
- type: types.STRING(5),
51
- allowNull: false,
52
- defaultValue: 'v1',
53
- },
54
- })
55
-
56
- IbmProvider.associate = (models) => {
57
- IbmProvider.belongsTo(models.Intelligence)
58
- IbmProvider.hasMany(models.Skill)
59
- }
60
-
61
- return IbmProvider
62
- }
1
+ exports.IbmProviderModel = (sequelize, types) => {
2
+ const IbmProvider = sequelize.define('IbmProvider', {
3
+ url: {
4
+ type: types.STRING,
5
+ allowNull: false,
6
+ validate: {
7
+ notEmpty: true,
8
+ },
9
+ },
10
+
11
+ token: {
12
+ type: types.STRING,
13
+ allowNull: false,
14
+ validate: {
15
+ notEmpty: true,
16
+ },
17
+ },
18
+
19
+ active: {
20
+ type: types.BOOLEAN,
21
+ defaultValue: true,
22
+ },
23
+
24
+ IntelligenceId: {
25
+ type: types.UUID,
26
+ allowNull: false,
27
+ validate: {
28
+ notEmpty: true,
29
+ },
30
+ },
31
+
32
+ EnterpriseId: {
33
+ type: types.UUID,
34
+ allowNull: true,
35
+ references: {
36
+ model: 'Enterprises',
37
+ key: 'id',
38
+ },
39
+ onDelete: 'RESTRICT',
40
+ onUpdate: 'CASCADE',
41
+ },
42
+
43
+ version: {
44
+ type: types.STRING(15),
45
+ allowNull: false,
46
+ defaultValue: '2018-09-20',
47
+ },
48
+
49
+ apiVersion: {
50
+ type: types.STRING(5),
51
+ allowNull: false,
52
+ defaultValue: 'v1',
53
+ },
54
+ })
55
+
56
+ IbmProvider.associate = (models) => {
57
+ IbmProvider.belongsTo(models.Intelligence)
58
+ IbmProvider.hasMany(models.Skill)
59
+ }
60
+
61
+ return IbmProvider
62
+ }
@@ -1,45 +1,45 @@
1
- const PROVIDER_TYPES = {
2
- AWS: 'aws',
3
- IBM: 'ibm',
4
- ITLEAN: 'itlean',
5
- }
6
-
7
- const PROVIDER_TYPE = [
8
- PROVIDER_TYPES.AWS,
9
- PROVIDER_TYPES.IBM,
10
- PROVIDER_TYPES.ITLEAN,
11
- ]
12
-
13
- const IntelligenceModel = (sequelize, types) => {
14
- const Intelligence = sequelize.define('Intelligence', {
15
- name: {
16
- type: types.STRING,
17
- allowNull: false,
18
- validate: {
19
- notEmpty: true,
20
- },
21
- },
22
- providerType: {
23
- type: types.ENUM({
24
- values: PROVIDER_TYPE,
25
- }),
26
- allowNull: false,
27
- validate: {
28
- notEmpty: true,
29
- },
30
- },
31
- })
32
-
33
- Intelligence.associate = models => {
34
- Intelligence.hasMany(models.Skill)
35
- Intelligence.hasMany(models.IbmProvider)
36
- }
37
-
38
- return Intelligence
39
- }
40
-
41
- module.exports = {
42
- IntelligenceModel,
43
- PROVIDER_TYPE,
44
- PROVIDER_TYPES,
45
- }
1
+ const PROVIDER_TYPES = {
2
+ AWS: 'aws',
3
+ IBM: 'ibm',
4
+ ITLEAN: 'itlean',
5
+ }
6
+
7
+ const PROVIDER_TYPE = [
8
+ PROVIDER_TYPES.AWS,
9
+ PROVIDER_TYPES.IBM,
10
+ PROVIDER_TYPES.ITLEAN,
11
+ ]
12
+
13
+ const IntelligenceModel = (sequelize, types) => {
14
+ const Intelligence = sequelize.define('Intelligence', {
15
+ name: {
16
+ type: types.STRING,
17
+ allowNull: false,
18
+ validate: {
19
+ notEmpty: true,
20
+ },
21
+ },
22
+ providerType: {
23
+ type: types.ENUM({
24
+ values: PROVIDER_TYPE,
25
+ }),
26
+ allowNull: false,
27
+ validate: {
28
+ notEmpty: true,
29
+ },
30
+ },
31
+ })
32
+
33
+ Intelligence.associate = models => {
34
+ Intelligence.hasMany(models.Skill)
35
+ Intelligence.hasMany(models.IbmProvider)
36
+ }
37
+
38
+ return Intelligence
39
+ }
40
+
41
+ module.exports = {
42
+ IntelligenceModel,
43
+ PROVIDER_TYPE,
44
+ PROVIDER_TYPES,
45
+ }
package/src/intention.js CHANGED
@@ -1,36 +1,36 @@
1
- exports.IntentionModel = (sequelize, types) => {
2
- const Intention = sequelize.define('Intention', {
3
- SkillId: {
4
- type: types.UUID,
5
- references: {
6
- model: 'Skill',
7
- key: 'id',
8
- },
9
- referencesKey: 'id',
10
- foreignKeyConstraint: true,
11
- allowNull: false,
12
- validate: {
13
- notEmpty: true,
14
- },
15
- },
16
-
17
- name: {
18
- type: types.STRING,
19
- allowNull: false,
20
- validate: {
21
- notEmpty: true,
22
- },
23
- },
24
-
25
- description: {
26
- type: types.STRING,
27
- },
28
- })
29
-
30
- Intention.associate = models => {
31
- Intention.belongsTo(models.Skill)
32
- Intention.hasMany(models.IntentionValue)
33
- }
34
-
35
- return Intention
36
- }
1
+ exports.IntentionModel = (sequelize, types) => {
2
+ const Intention = sequelize.define('Intention', {
3
+ SkillId: {
4
+ type: types.UUID,
5
+ references: {
6
+ model: 'Skill',
7
+ key: 'id',
8
+ },
9
+ referencesKey: 'id',
10
+ foreignKeyConstraint: true,
11
+ allowNull: false,
12
+ validate: {
13
+ notEmpty: true,
14
+ },
15
+ },
16
+
17
+ name: {
18
+ type: types.STRING,
19
+ allowNull: false,
20
+ validate: {
21
+ notEmpty: true,
22
+ },
23
+ },
24
+
25
+ description: {
26
+ type: types.STRING,
27
+ },
28
+ })
29
+
30
+ Intention.associate = models => {
31
+ Intention.belongsTo(models.Skill)
32
+ Intention.hasMany(models.IntentionValue)
33
+ }
34
+
35
+ return Intention
36
+ }
@@ -1,31 +1,31 @@
1
- exports.IntentionValueModel = (sequelize, types) => {
2
- const IntentionValue = sequelize.define('IntentionValue', {
3
- IntentionId: {
4
- type: types.UUID,
5
- references: {
6
- model: 'Intention',
7
- key: 'id',
8
- },
9
- referencesKey: 'id',
10
- foreignKeyConstraint: true,
11
- allowNull: false,
12
- validate: {
13
- notEmpty: true,
14
- },
15
- },
16
-
17
- name: {
18
- type: types.STRING,
19
- allowNull: false,
20
- validate: {
21
- notEmpty: true,
22
- },
23
- },
24
- })
25
-
26
- IntentionValue.associate = models => {
27
- IntentionValue.belongsTo(models.Intention)
28
- }
29
-
30
- return IntentionValue
31
- }
1
+ exports.IntentionValueModel = (sequelize, types) => {
2
+ const IntentionValue = sequelize.define('IntentionValue', {
3
+ IntentionId: {
4
+ type: types.UUID,
5
+ references: {
6
+ model: 'Intention',
7
+ key: 'id',
8
+ },
9
+ referencesKey: 'id',
10
+ foreignKeyConstraint: true,
11
+ allowNull: false,
12
+ validate: {
13
+ notEmpty: true,
14
+ },
15
+ },
16
+
17
+ name: {
18
+ type: types.STRING,
19
+ allowNull: false,
20
+ validate: {
21
+ notEmpty: true,
22
+ },
23
+ },
24
+ })
25
+
26
+ IntentionValue.associate = models => {
27
+ IntentionValue.belongsTo(models.Intention)
28
+ }
29
+
30
+ return IntentionValue
31
+ }
package/src/lines.js CHANGED
@@ -1,48 +1,48 @@
1
- exports.LinesModel = (sequelize, DataTypes) => {
2
- const Lines = sequelize.define('Lines', {
3
- BranchId: {
4
- type: DataTypes.UUID,
5
- allowNull: false,
6
- references: {
7
- model: 'Branches',
8
- key: 'id',
9
- },
10
- onDelete: 'RESTRICT',
11
- onUpdate: 'CASCADE',
12
- },
13
- DepartmentId: {
14
- type: DataTypes.UUID,
15
- allowNull: false,
16
- references: {
17
- model: 'Departments',
18
- key: 'id',
19
- },
20
- onDelete: 'RESTRICT',
21
- onUpdate: 'CASCADE',
22
- },
23
- SubDepartmentId: {
24
- type: DataTypes.UUID,
25
- allowNull: false,
26
- references: {
27
- model: 'SubDepartments',
28
- key: 'id',
29
- },
30
- onDelete: 'RESTRICT',
31
- onUpdate: 'CASCADE',
32
- },
33
- })
34
-
35
- Lines.associate = models => {
36
- Lines.belongsTo(models.Branches)
37
- Lines.belongsTo(models.Departments)
38
- Lines.belongsTo(models.SubDepartments)
39
- Lines.belongsToMany(models.SystemUsers, {
40
- through: models.SystemUsers_Lines,
41
- })
42
- Lines.hasOne(models.LineConfigurations)
43
- Lines.hasMany(models.Attendances)
44
- Lines.hasMany(models.QuickMessages)
45
- }
46
-
47
- return Lines
48
- }
1
+ exports.LinesModel = (sequelize, DataTypes) => {
2
+ const Lines = sequelize.define('Lines', {
3
+ BranchId: {
4
+ type: DataTypes.UUID,
5
+ allowNull: false,
6
+ references: {
7
+ model: 'Branches',
8
+ key: 'id',
9
+ },
10
+ onDelete: 'RESTRICT',
11
+ onUpdate: 'CASCADE',
12
+ },
13
+ DepartmentId: {
14
+ type: DataTypes.UUID,
15
+ allowNull: false,
16
+ references: {
17
+ model: 'Departments',
18
+ key: 'id',
19
+ },
20
+ onDelete: 'RESTRICT',
21
+ onUpdate: 'CASCADE',
22
+ },
23
+ SubDepartmentId: {
24
+ type: DataTypes.UUID,
25
+ allowNull: false,
26
+ references: {
27
+ model: 'SubDepartments',
28
+ key: 'id',
29
+ },
30
+ onDelete: 'RESTRICT',
31
+ onUpdate: 'CASCADE',
32
+ },
33
+ })
34
+
35
+ Lines.associate = models => {
36
+ Lines.belongsTo(models.Branches)
37
+ Lines.belongsTo(models.Departments)
38
+ Lines.belongsTo(models.SubDepartments)
39
+ Lines.belongsToMany(models.SystemUsers, {
40
+ through: models.SystemUsers_Lines,
41
+ })
42
+ Lines.hasOne(models.LineConfigurations)
43
+ Lines.hasMany(models.Attendances)
44
+ Lines.hasMany(models.QuickMessages)
45
+ }
46
+
47
+ return Lines
48
+ }
package/src/profile.js CHANGED
@@ -1,23 +1,23 @@
1
- exports.ProfilesModel = (sequelize, DataTypes) => {
2
- const Profiles = sequelize.define('Profiles', {
3
- name: {
4
- allowNull: false,
5
- unique: true,
6
- type: DataTypes.STRING(50),
7
- validate: {
8
- notEmpty: true,
9
- },
10
- },
11
- })
12
-
13
- Profiles.associate = models => {
14
- Profiles.belongsToMany(models.Permissions, {
15
- through: models.Profiles_Permissions,
16
- })
17
- Profiles.belongsToMany(models.SystemUsers, {
18
- through: models.SystemUsers_Profiles,
19
- })
20
- }
21
-
22
- return Profiles
23
- }
1
+ exports.ProfilesModel = (sequelize, DataTypes) => {
2
+ const Profiles = sequelize.define('Profiles', {
3
+ name: {
4
+ allowNull: false,
5
+ unique: true,
6
+ type: DataTypes.STRING(50),
7
+ validate: {
8
+ notEmpty: true,
9
+ },
10
+ },
11
+ })
12
+
13
+ Profiles.associate = models => {
14
+ Profiles.belongsToMany(models.Permissions, {
15
+ through: models.Profiles_Permissions,
16
+ })
17
+ Profiles.belongsToMany(models.SystemUsers, {
18
+ through: models.SystemUsers_Profiles,
19
+ })
20
+ }
21
+
22
+ return Profiles
23
+ }
@@ -1,25 +1,25 @@
1
- exports.Profiles_PermissionsModel = (sequelize, DataTypes) => {
2
- const Profiles_Permissions = sequelize.define('Profiles_Permissions', {
3
- ProfileId: {
4
- type: DataTypes.UUID,
5
- allowNull: false,
6
- references: {
7
- model: 'Profiles',
8
- key: 'id',
9
- },
10
- onDelete: 'RESTRICT',
11
- onUpdate: 'CASCADE',
12
- },
13
- PermissionId: {
14
- type: DataTypes.UUID,
15
- allowNull: false,
16
- references: {
17
- model: 'Permissions',
18
- key: 'id',
19
- },
20
- onDelete: 'RESTRICT',
21
- onUpdate: 'CASCADE',
22
- },
23
- })
24
- return Profiles_Permissions
25
- }
1
+ exports.Profiles_PermissionsModel = (sequelize, DataTypes) => {
2
+ const Profiles_Permissions = sequelize.define('Profiles_Permissions', {
3
+ ProfileId: {
4
+ type: DataTypes.UUID,
5
+ allowNull: false,
6
+ references: {
7
+ model: 'Profiles',
8
+ key: 'id',
9
+ },
10
+ onDelete: 'RESTRICT',
11
+ onUpdate: 'CASCADE',
12
+ },
13
+ PermissionId: {
14
+ type: DataTypes.UUID,
15
+ allowNull: false,
16
+ references: {
17
+ model: 'Permissions',
18
+ key: 'id',
19
+ },
20
+ onDelete: 'RESTRICT',
21
+ onUpdate: 'CASCADE',
22
+ },
23
+ })
24
+ return Profiles_Permissions
25
+ }
@@ -0,0 +1,32 @@
1
+ exports.Response_DialogNodesModel = (sequelize, Sequelize) => {
2
+ const Response_DialogNodes = sequelize.define('Response_DialogNodes', {
3
+ DialogNodeId: {
4
+ type: Sequelize.UUID,
5
+ allowNull: true,
6
+ references: {
7
+ model: 'DialogNodes',
8
+ key: 'id',
9
+ },
10
+ onDelete: 'RESTRICT',
11
+ onUpdate: 'CASCADE',
12
+ },
13
+ ResponseId: {
14
+ type: Sequelize.UUID,
15
+ allowNull: true,
16
+ references: {
17
+ model: 'Responses',
18
+ key: 'id',
19
+ },
20
+ onDelete: 'RESTRICT',
21
+ onUpdate: 'CASCADE',
22
+ },
23
+ })
24
+
25
+ Response_DialogNodes.associate = (models) => {
26
+ Response_DialogNodes.belongsTo(models.Responses)
27
+ Response_DialogNodes.belongsTo(models.DialogNodes)
28
+ }
29
+
30
+ return Response_DialogNodes
31
+ }
32
+