@itleanchatbot/shared-models-js-postgres 1.1.63 → 1.1.64
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/README.md +18 -18
- package/index.js +104 -104
- package/package.json +41 -41
- package/src/apiResourceBodies.js +41 -41
- package/src/apiResourceHeaders.js +29 -29
- package/src/apiResourcePathParams.js +28 -28
- package/src/apiResourceQueryStringParams.js +36 -36
- package/src/apiResources.js +72 -72
- package/src/apis.js +65 -65
- package/src/attendanceScale.js +40 -40
- package/src/attendanceScaleOff.js +56 -56
- package/src/attendances.js +85 -85
- package/src/botIterable.js +38 -38
- package/src/branches.js +35 -35
- package/src/channelConfigurations.js +41 -41
- package/src/channelTypes.js +52 -52
- package/src/channels.js +54 -54
- package/src/client.js +23 -23
- package/src/comments.js +27 -27
- package/src/departments.js +35 -35
- package/src/dialogNodes.js +153 -153
- package/src/dialogNodes_MultipleResponses.js +39 -39
- package/src/dialogNodes_apiResources.js +45 -45
- package/src/enterprises.js +29 -29
- package/src/entity.js +34 -34
- package/src/entityValues.js +63 -63
- package/src/faqTriggers.js +50 -50
- package/src/files.js +35 -35
- package/src/ibmProvider.js +56 -56
- package/src/intelligence.js +45 -45
- package/src/intention.js +36 -36
- package/src/intentionValue.js +31 -31
- package/src/itleanProvider.js +33 -33
- package/src/lineConfigurations.js +62 -62
- package/src/lines.js +48 -48
- package/src/permissions.js +27 -27
- package/src/postbackGupshup.js +27 -0
- package/src/profile.js +23 -23
- package/src/profiles_permission.js +25 -25
- package/src/quickMessages.js +34 -34
- package/src/response_DialogNodes.js +31 -31
- package/src/responses.js +54 -54
- package/src/responsesBoxes.js +65 -65
- package/src/returnHsm.js +31 -0
- package/src/sessions.js +56 -56
- package/src/skill.js +111 -111
- package/src/socketClients.js +56 -56
- package/src/subDepartments.js +35 -35
- package/src/synonyms.js +67 -67
- package/src/systemUsers.js +54 -54
- package/src/systemUsers_Lines.js +25 -25
- package/src/systemUsers_profiles.js +25 -25
- package/src/transhipConversations.js +50 -50
- package/src/transhipTriggers.js +102 -102
package/src/responses.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
const RESPONSE_BOXES_TYPES = {
|
|
3
|
-
FLOW: 'flow',
|
|
4
|
-
FAQ: 'faq',
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const RESPONSE_BOXES_TYPE = [
|
|
8
|
-
RESPONSE_BOXES_TYPES.FLOW,
|
|
9
|
-
RESPONSE_BOXES_TYPES.FAQ,
|
|
10
|
-
]
|
|
11
|
-
|
|
12
|
-
const ResponsesModel = (sequelize, types) => {
|
|
13
|
-
const Responses = sequelize.define('Responses', {
|
|
14
|
-
SkillId: {
|
|
15
|
-
type: types.UUID,
|
|
16
|
-
references: {
|
|
17
|
-
model: 'Skill',
|
|
18
|
-
key: 'id',
|
|
19
|
-
},
|
|
20
|
-
referencesKey: 'id',
|
|
21
|
-
foreignKeyConstraint: true,
|
|
22
|
-
allowNull: false,
|
|
23
|
-
validate: {
|
|
24
|
-
notEmpty: true,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
name: {
|
|
28
|
-
type: types.STRING(255),
|
|
29
|
-
allowNull: false,
|
|
30
|
-
validate: {
|
|
31
|
-
notEmpty: true,
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
type: {
|
|
35
|
-
type: types.ENUM({
|
|
36
|
-
values: RESPONSE_BOXES_TYPE,
|
|
37
|
-
}),
|
|
38
|
-
allowNull: false,
|
|
39
|
-
defaultValue: RESPONSE_BOXES_TYPES.FLOW,
|
|
40
|
-
},
|
|
41
|
-
})
|
|
42
|
-
Responses.associate = (models) => {
|
|
43
|
-
Responses.belongsTo(models.Skill)
|
|
44
|
-
Responses.hasMany(models.ResponsesBoxes)
|
|
45
|
-
Responses.hasMany(models.Response_DialogNodes)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return Responses
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
module.exports = {
|
|
52
|
-
RESPONSE_BOXES_TYPE,
|
|
53
|
-
RESPONSE_BOXES_TYPES,
|
|
54
|
-
ResponsesModel
|
|
1
|
+
|
|
2
|
+
const RESPONSE_BOXES_TYPES = {
|
|
3
|
+
FLOW: 'flow',
|
|
4
|
+
FAQ: 'faq',
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const RESPONSE_BOXES_TYPE = [
|
|
8
|
+
RESPONSE_BOXES_TYPES.FLOW,
|
|
9
|
+
RESPONSE_BOXES_TYPES.FAQ,
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
const ResponsesModel = (sequelize, types) => {
|
|
13
|
+
const Responses = sequelize.define('Responses', {
|
|
14
|
+
SkillId: {
|
|
15
|
+
type: types.UUID,
|
|
16
|
+
references: {
|
|
17
|
+
model: 'Skill',
|
|
18
|
+
key: 'id',
|
|
19
|
+
},
|
|
20
|
+
referencesKey: 'id',
|
|
21
|
+
foreignKeyConstraint: true,
|
|
22
|
+
allowNull: false,
|
|
23
|
+
validate: {
|
|
24
|
+
notEmpty: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
name: {
|
|
28
|
+
type: types.STRING(255),
|
|
29
|
+
allowNull: false,
|
|
30
|
+
validate: {
|
|
31
|
+
notEmpty: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
type: {
|
|
35
|
+
type: types.ENUM({
|
|
36
|
+
values: RESPONSE_BOXES_TYPE,
|
|
37
|
+
}),
|
|
38
|
+
allowNull: false,
|
|
39
|
+
defaultValue: RESPONSE_BOXES_TYPES.FLOW,
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
Responses.associate = (models) => {
|
|
43
|
+
Responses.belongsTo(models.Skill)
|
|
44
|
+
Responses.hasMany(models.ResponsesBoxes)
|
|
45
|
+
Responses.hasMany(models.Response_DialogNodes)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return Responses
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
module.exports = {
|
|
52
|
+
RESPONSE_BOXES_TYPE,
|
|
53
|
+
RESPONSE_BOXES_TYPES,
|
|
54
|
+
ResponsesModel
|
|
55
55
|
}
|
package/src/responsesBoxes.js
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
const RESPONSE_BOXES_TYPES = {
|
|
3
|
-
FLOW: 'flow',
|
|
4
|
-
FAQ: 'faq',
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const RESPONSE_BOXES_TYPE = [
|
|
8
|
-
RESPONSE_BOXES_TYPES.FLOW,
|
|
9
|
-
RESPONSE_BOXES_TYPES.FAQ,
|
|
10
|
-
]
|
|
11
|
-
|
|
12
|
-
const ResponsesBoxesModel = (sequelize, types) => {
|
|
13
|
-
const ResponsesBoxes = sequelize.define('ResponsesBoxes', {
|
|
14
|
-
ResponseId: {
|
|
15
|
-
type: types.UUID,
|
|
16
|
-
references: {
|
|
17
|
-
model: 'Responses',
|
|
18
|
-
key: 'id',
|
|
19
|
-
},
|
|
20
|
-
referencesKey: 'id',
|
|
21
|
-
foreignKeyConstraint: true,
|
|
22
|
-
allowNull: false,
|
|
23
|
-
validate: {
|
|
24
|
-
notEmpty: true,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
ChannelTypeId: {
|
|
28
|
-
type: types.UUID,
|
|
29
|
-
allowNull: true,
|
|
30
|
-
references: {
|
|
31
|
-
model: 'ChannelTypes',
|
|
32
|
-
key: 'id',
|
|
33
|
-
},
|
|
34
|
-
onDelete: 'RESTRICT',
|
|
35
|
-
onUpdate: 'CASCADE',
|
|
36
|
-
foreignKeyConstraint: true,
|
|
37
|
-
},
|
|
38
|
-
payload: {
|
|
39
|
-
type: types.JSON,
|
|
40
|
-
defaultValue: '{}',
|
|
41
|
-
allowNull: false,
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
type: {
|
|
45
|
-
type: types.ENUM({
|
|
46
|
-
values: RESPONSE_BOXES_TYPE,
|
|
47
|
-
}),
|
|
48
|
-
allowNull: false,
|
|
49
|
-
defaultValue: RESPONSE_BOXES_TYPES.FLOW,
|
|
50
|
-
},
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
ResponsesBoxes.associate = models => {
|
|
54
|
-
ResponsesBoxes.belongsTo(models.Responses)
|
|
55
|
-
ResponsesBoxes.belongsTo(models.ChannelTypes)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return ResponsesBoxes
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
module.exports = {
|
|
63
|
-
RESPONSE_BOXES_TYPE,
|
|
64
|
-
RESPONSE_BOXES_TYPES,
|
|
65
|
-
ResponsesBoxesModel
|
|
1
|
+
|
|
2
|
+
const RESPONSE_BOXES_TYPES = {
|
|
3
|
+
FLOW: 'flow',
|
|
4
|
+
FAQ: 'faq',
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const RESPONSE_BOXES_TYPE = [
|
|
8
|
+
RESPONSE_BOXES_TYPES.FLOW,
|
|
9
|
+
RESPONSE_BOXES_TYPES.FAQ,
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
const ResponsesBoxesModel = (sequelize, types) => {
|
|
13
|
+
const ResponsesBoxes = sequelize.define('ResponsesBoxes', {
|
|
14
|
+
ResponseId: {
|
|
15
|
+
type: types.UUID,
|
|
16
|
+
references: {
|
|
17
|
+
model: 'Responses',
|
|
18
|
+
key: 'id',
|
|
19
|
+
},
|
|
20
|
+
referencesKey: 'id',
|
|
21
|
+
foreignKeyConstraint: true,
|
|
22
|
+
allowNull: false,
|
|
23
|
+
validate: {
|
|
24
|
+
notEmpty: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
ChannelTypeId: {
|
|
28
|
+
type: types.UUID,
|
|
29
|
+
allowNull: true,
|
|
30
|
+
references: {
|
|
31
|
+
model: 'ChannelTypes',
|
|
32
|
+
key: 'id',
|
|
33
|
+
},
|
|
34
|
+
onDelete: 'RESTRICT',
|
|
35
|
+
onUpdate: 'CASCADE',
|
|
36
|
+
foreignKeyConstraint: true,
|
|
37
|
+
},
|
|
38
|
+
payload: {
|
|
39
|
+
type: types.JSON,
|
|
40
|
+
defaultValue: '{}',
|
|
41
|
+
allowNull: false,
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
type: {
|
|
45
|
+
type: types.ENUM({
|
|
46
|
+
values: RESPONSE_BOXES_TYPE,
|
|
47
|
+
}),
|
|
48
|
+
allowNull: false,
|
|
49
|
+
defaultValue: RESPONSE_BOXES_TYPES.FLOW,
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
ResponsesBoxes.associate = models => {
|
|
54
|
+
ResponsesBoxes.belongsTo(models.Responses)
|
|
55
|
+
ResponsesBoxes.belongsTo(models.ChannelTypes)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return ResponsesBoxes
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
module.exports = {
|
|
63
|
+
RESPONSE_BOXES_TYPE,
|
|
64
|
+
RESPONSE_BOXES_TYPES,
|
|
65
|
+
ResponsesBoxesModel
|
|
66
66
|
}
|
package/src/returnHsm.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const ReturnHsmsModel = sequelize.define('ReturnHsms', {
|
|
3
|
+
body: {
|
|
4
|
+
allowNull: true,
|
|
5
|
+
type: DataTypes.JSONB,
|
|
6
|
+
},
|
|
7
|
+
media_id: {
|
|
8
|
+
allowNull: true,
|
|
9
|
+
type: DataTypes.STRING,
|
|
10
|
+
},
|
|
11
|
+
messageId: {
|
|
12
|
+
allowNull: true,
|
|
13
|
+
type: DataTypes.STRING,
|
|
14
|
+
},
|
|
15
|
+
status: {
|
|
16
|
+
allowNull: true,
|
|
17
|
+
type: DataTypes.STRING,
|
|
18
|
+
},
|
|
19
|
+
timestamp: {
|
|
20
|
+
allowNull: true,
|
|
21
|
+
type: DataTypes.STRING,
|
|
22
|
+
},
|
|
23
|
+
to: {
|
|
24
|
+
allowNull: true,
|
|
25
|
+
type: DataTypes.STRING,
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
return ReturnHsmsModel
|
|
30
|
+
}
|
|
31
|
+
|
package/src/sessions.js
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
exports.SessionsModel = (sequelize, DataTypes) => {
|
|
2
|
-
const Sessions = sequelize.define('Sessions', {
|
|
3
|
-
ChannelId: {
|
|
4
|
-
type: DataTypes.UUID,
|
|
5
|
-
allowNull: false,
|
|
6
|
-
references: {
|
|
7
|
-
model: 'Channels',
|
|
8
|
-
key: 'id',
|
|
9
|
-
},
|
|
10
|
-
onDelete: 'RESTRICT',
|
|
11
|
-
onUpdate: 'CASCADE',
|
|
12
|
-
},
|
|
13
|
-
ClientId: {
|
|
14
|
-
type: DataTypes.UUID,
|
|
15
|
-
references: {
|
|
16
|
-
model: 'Clients',
|
|
17
|
-
key: 'id',
|
|
18
|
-
},
|
|
19
|
-
allowNull: false,
|
|
20
|
-
onDelete: 'CASCADE',
|
|
21
|
-
onUpdate: 'CASCADE',
|
|
22
|
-
},
|
|
23
|
-
context: {
|
|
24
|
-
type: DataTypes.JSON,
|
|
25
|
-
allowNull: true,
|
|
26
|
-
validate: {
|
|
27
|
-
notEmpty: false,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
tranship: {
|
|
31
|
-
type: DataTypes.BOOLEAN,
|
|
32
|
-
defaultValue: false,
|
|
33
|
-
},
|
|
34
|
-
status: {
|
|
35
|
-
type: DataTypes.ENUM(['open', 'closed', 'expired']),
|
|
36
|
-
defaultValue: 'open',
|
|
37
|
-
allowNull: false,
|
|
38
|
-
validate: {
|
|
39
|
-
notEmpty: false,
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
endOfSession: {
|
|
43
|
-
type: DataTypes.DATE,
|
|
44
|
-
allowNull: true,
|
|
45
|
-
},
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
Sessions.associate = models => {
|
|
49
|
-
Sessions.belongsTo(models.Channels)
|
|
50
|
-
Sessions.hasOne(models.Attendances)
|
|
51
|
-
Sessions.hasOne(models.SocketClients)
|
|
52
|
-
Sessions.belongsTo(models.Client)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return Sessions
|
|
56
|
-
}
|
|
1
|
+
exports.SessionsModel = (sequelize, DataTypes) => {
|
|
2
|
+
const Sessions = sequelize.define('Sessions', {
|
|
3
|
+
ChannelId: {
|
|
4
|
+
type: DataTypes.UUID,
|
|
5
|
+
allowNull: false,
|
|
6
|
+
references: {
|
|
7
|
+
model: 'Channels',
|
|
8
|
+
key: 'id',
|
|
9
|
+
},
|
|
10
|
+
onDelete: 'RESTRICT',
|
|
11
|
+
onUpdate: 'CASCADE',
|
|
12
|
+
},
|
|
13
|
+
ClientId: {
|
|
14
|
+
type: DataTypes.UUID,
|
|
15
|
+
references: {
|
|
16
|
+
model: 'Clients',
|
|
17
|
+
key: 'id',
|
|
18
|
+
},
|
|
19
|
+
allowNull: false,
|
|
20
|
+
onDelete: 'CASCADE',
|
|
21
|
+
onUpdate: 'CASCADE',
|
|
22
|
+
},
|
|
23
|
+
context: {
|
|
24
|
+
type: DataTypes.JSON,
|
|
25
|
+
allowNull: true,
|
|
26
|
+
validate: {
|
|
27
|
+
notEmpty: false,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
tranship: {
|
|
31
|
+
type: DataTypes.BOOLEAN,
|
|
32
|
+
defaultValue: false,
|
|
33
|
+
},
|
|
34
|
+
status: {
|
|
35
|
+
type: DataTypes.ENUM(['open', 'closed', 'expired']),
|
|
36
|
+
defaultValue: 'open',
|
|
37
|
+
allowNull: false,
|
|
38
|
+
validate: {
|
|
39
|
+
notEmpty: false,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
endOfSession: {
|
|
43
|
+
type: DataTypes.DATE,
|
|
44
|
+
allowNull: true,
|
|
45
|
+
},
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
Sessions.associate = models => {
|
|
49
|
+
Sessions.belongsTo(models.Channels)
|
|
50
|
+
Sessions.hasOne(models.Attendances)
|
|
51
|
+
Sessions.hasOne(models.SocketClients)
|
|
52
|
+
Sessions.belongsTo(models.Client)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return Sessions
|
|
56
|
+
}
|
package/src/skill.js
CHANGED
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
const SKILL_LANG = ['pt-br']
|
|
2
|
-
|
|
3
|
-
const STATUS_TYPES = {
|
|
4
|
-
NOT_ACTION: 'without_action',
|
|
5
|
-
WAIT: 'waiting',
|
|
6
|
-
SUCCESS: 'success',
|
|
7
|
-
FAIL: 'failed',
|
|
8
|
-
CANCEL: 'cancel',
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const STATUS = [
|
|
12
|
-
STATUS_TYPES.NOT_ACTION,
|
|
13
|
-
STATUS_TYPES.WAIT,
|
|
14
|
-
STATUS_TYPES.SUCCESS,
|
|
15
|
-
STATUS_TYPES.FAIL,
|
|
16
|
-
STATUS_TYPES.CANCEL,
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
const SkillModel = (sequelize, types) => {
|
|
20
|
-
const Skill = sequelize.define('Skill', {
|
|
21
|
-
IntelligenceId: {
|
|
22
|
-
type: types.UUID,
|
|
23
|
-
allowNull: false,
|
|
24
|
-
references: {
|
|
25
|
-
model: 'Intelligence',
|
|
26
|
-
key: 'id',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
AwsProviderId: {
|
|
31
|
-
type: types.UUID,
|
|
32
|
-
},
|
|
33
|
-
IbmProviderId: {
|
|
34
|
-
type: types.UUID,
|
|
35
|
-
allowNull: true,
|
|
36
|
-
references: {
|
|
37
|
-
model: 'IbmProvider',
|
|
38
|
-
key: 'id',
|
|
39
|
-
},
|
|
40
|
-
onDelete: 'RESTRICT',
|
|
41
|
-
onUpdate: 'CASCADE',
|
|
42
|
-
},
|
|
43
|
-
ItleanProviderId: {
|
|
44
|
-
type: types.UUID,
|
|
45
|
-
allowNull: true,
|
|
46
|
-
references: {
|
|
47
|
-
model: 'ItleanProvider',
|
|
48
|
-
key: 'id',
|
|
49
|
-
},
|
|
50
|
-
onDelete: 'RESTRICT',
|
|
51
|
-
onUpdate: 'CASCADE',
|
|
52
|
-
},
|
|
53
|
-
name: {
|
|
54
|
-
type: types.STRING,
|
|
55
|
-
allowNull: false,
|
|
56
|
-
validate: {
|
|
57
|
-
notEmpty: true,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
description: {
|
|
61
|
-
type: types.STRING,
|
|
62
|
-
defaultValue: '',
|
|
63
|
-
},
|
|
64
|
-
lang: {
|
|
65
|
-
type: types.ENUM({
|
|
66
|
-
values: SKILL_LANG,
|
|
67
|
-
}),
|
|
68
|
-
allowNull: false,
|
|
69
|
-
validate: {
|
|
70
|
-
notEmpty: true,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
publishProcessStatus: {
|
|
74
|
-
type: types.ENUM({
|
|
75
|
-
values: STATUS,
|
|
76
|
-
}),
|
|
77
|
-
defaultValue: STATUS_TYPES.NOT_ACTION,
|
|
78
|
-
},
|
|
79
|
-
externalIbmId: {
|
|
80
|
-
type: types.STRING,
|
|
81
|
-
},
|
|
82
|
-
publishedOnProvider: {
|
|
83
|
-
type: types.BOOLEAN,
|
|
84
|
-
defaultValue: false,
|
|
85
|
-
},
|
|
86
|
-
deletedAt: {
|
|
87
|
-
allowNull: true,
|
|
88
|
-
type: types.DATE,
|
|
89
|
-
defaultValue: null
|
|
90
|
-
}
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
Skill.associate = models => {
|
|
94
|
-
Skill.belongsTo(models.Intelligence)
|
|
95
|
-
Skill.belongsTo(models.IbmProvider)
|
|
96
|
-
Skill.belongsTo(models.ItleanProvider)
|
|
97
|
-
Skill.hasMany(models.Intention)
|
|
98
|
-
Skill.hasMany(models.Entity)
|
|
99
|
-
Skill.hasMany(models.Channels)
|
|
100
|
-
Skill.hasMany(models.DialogNodes)
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return Skill
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
module.exports = {
|
|
107
|
-
SkillModel,
|
|
108
|
-
SKILL_LANG,
|
|
109
|
-
STATUS,
|
|
110
|
-
STATUS_TYPES,
|
|
111
|
-
}
|
|
1
|
+
const SKILL_LANG = ['pt-br']
|
|
2
|
+
|
|
3
|
+
const STATUS_TYPES = {
|
|
4
|
+
NOT_ACTION: 'without_action',
|
|
5
|
+
WAIT: 'waiting',
|
|
6
|
+
SUCCESS: 'success',
|
|
7
|
+
FAIL: 'failed',
|
|
8
|
+
CANCEL: 'cancel',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const STATUS = [
|
|
12
|
+
STATUS_TYPES.NOT_ACTION,
|
|
13
|
+
STATUS_TYPES.WAIT,
|
|
14
|
+
STATUS_TYPES.SUCCESS,
|
|
15
|
+
STATUS_TYPES.FAIL,
|
|
16
|
+
STATUS_TYPES.CANCEL,
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
const SkillModel = (sequelize, types) => {
|
|
20
|
+
const Skill = sequelize.define('Skill', {
|
|
21
|
+
IntelligenceId: {
|
|
22
|
+
type: types.UUID,
|
|
23
|
+
allowNull: false,
|
|
24
|
+
references: {
|
|
25
|
+
model: 'Intelligence',
|
|
26
|
+
key: 'id',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
AwsProviderId: {
|
|
31
|
+
type: types.UUID,
|
|
32
|
+
},
|
|
33
|
+
IbmProviderId: {
|
|
34
|
+
type: types.UUID,
|
|
35
|
+
allowNull: true,
|
|
36
|
+
references: {
|
|
37
|
+
model: 'IbmProvider',
|
|
38
|
+
key: 'id',
|
|
39
|
+
},
|
|
40
|
+
onDelete: 'RESTRICT',
|
|
41
|
+
onUpdate: 'CASCADE',
|
|
42
|
+
},
|
|
43
|
+
ItleanProviderId: {
|
|
44
|
+
type: types.UUID,
|
|
45
|
+
allowNull: true,
|
|
46
|
+
references: {
|
|
47
|
+
model: 'ItleanProvider',
|
|
48
|
+
key: 'id',
|
|
49
|
+
},
|
|
50
|
+
onDelete: 'RESTRICT',
|
|
51
|
+
onUpdate: 'CASCADE',
|
|
52
|
+
},
|
|
53
|
+
name: {
|
|
54
|
+
type: types.STRING,
|
|
55
|
+
allowNull: false,
|
|
56
|
+
validate: {
|
|
57
|
+
notEmpty: true,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
description: {
|
|
61
|
+
type: types.STRING,
|
|
62
|
+
defaultValue: '',
|
|
63
|
+
},
|
|
64
|
+
lang: {
|
|
65
|
+
type: types.ENUM({
|
|
66
|
+
values: SKILL_LANG,
|
|
67
|
+
}),
|
|
68
|
+
allowNull: false,
|
|
69
|
+
validate: {
|
|
70
|
+
notEmpty: true,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
publishProcessStatus: {
|
|
74
|
+
type: types.ENUM({
|
|
75
|
+
values: STATUS,
|
|
76
|
+
}),
|
|
77
|
+
defaultValue: STATUS_TYPES.NOT_ACTION,
|
|
78
|
+
},
|
|
79
|
+
externalIbmId: {
|
|
80
|
+
type: types.STRING,
|
|
81
|
+
},
|
|
82
|
+
publishedOnProvider: {
|
|
83
|
+
type: types.BOOLEAN,
|
|
84
|
+
defaultValue: false,
|
|
85
|
+
},
|
|
86
|
+
deletedAt: {
|
|
87
|
+
allowNull: true,
|
|
88
|
+
type: types.DATE,
|
|
89
|
+
defaultValue: null
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
Skill.associate = models => {
|
|
94
|
+
Skill.belongsTo(models.Intelligence)
|
|
95
|
+
Skill.belongsTo(models.IbmProvider)
|
|
96
|
+
Skill.belongsTo(models.ItleanProvider)
|
|
97
|
+
Skill.hasMany(models.Intention)
|
|
98
|
+
Skill.hasMany(models.Entity)
|
|
99
|
+
Skill.hasMany(models.Channels)
|
|
100
|
+
Skill.hasMany(models.DialogNodes)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return Skill
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
module.exports = {
|
|
107
|
+
SkillModel,
|
|
108
|
+
SKILL_LANG,
|
|
109
|
+
STATUS,
|
|
110
|
+
STATUS_TYPES,
|
|
111
|
+
}
|