@itleanchatbot/shared-models-js-postgres 1.0.19 → 1.0.21
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/index.js +7 -1
- package/package.json +1 -1
- package/src/dialogNodes.js +4 -0
- package/src/response_DialogNodes.js +32 -0
- package/src/responses.js +55 -0
- package/src/responsesBoxes.js +61 -0
package/index.js
CHANGED
|
@@ -40,6 +40,9 @@ const apiResourceQueryStringParams = require('./src/apiResourceQueryStringParams
|
|
|
40
40
|
const dialogNodes = require('./src/dialogNodes')
|
|
41
41
|
const dialogNodes_MultipleResponses = require('./src/dialogNodes_MultipleResponses')
|
|
42
42
|
const dialogNodes_apiResources = require('./src/dialogNodes_apiResources')
|
|
43
|
+
const response_DialogNodes = require('./src/response_DialogNodes')
|
|
44
|
+
const responses = require('./src/responses')
|
|
45
|
+
const responsesBoxes = require('./src/responsesBoxes')
|
|
43
46
|
|
|
44
47
|
module.exports = {
|
|
45
48
|
attendances,
|
|
@@ -83,5 +86,8 @@ module.exports = {
|
|
|
83
86
|
apiResourceQueryStringParams,
|
|
84
87
|
dialogNodes,
|
|
85
88
|
dialogNodes_MultipleResponses,
|
|
86
|
-
dialogNodes_apiResources
|
|
89
|
+
dialogNodes_apiResources,
|
|
90
|
+
response_DialogNodes,
|
|
91
|
+
responses,
|
|
92
|
+
responsesBoxes
|
|
87
93
|
}
|
package/package.json
CHANGED
package/src/dialogNodes.js
CHANGED
|
@@ -105,6 +105,10 @@ const DialogNodesModel = (sequelize, Sequelize) => {
|
|
|
105
105
|
})
|
|
106
106
|
DialogNodes.hasMany(models.DialogNodes_MultipleResponses)
|
|
107
107
|
DialogNodes.hasMany(models.DialogNodes_ApiResources)
|
|
108
|
+
DialogNodes.hasMany(models.Skill_ApiResources, {
|
|
109
|
+
foreignKey: 'SkillId'
|
|
110
|
+
})
|
|
111
|
+
}
|
|
108
112
|
}
|
|
109
113
|
|
|
110
114
|
return DialogNodes
|
|
@@ -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
|
+
|
package/src/responses.js
ADDED
|
@@ -0,0 +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,
|
|
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.hasOne(models.Response_DialogNodes)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return Responses
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
module.exports = {
|
|
52
|
+
RESPONSE_BOXES_TYPE,
|
|
53
|
+
RESPONSE_BOXES_TYPES,
|
|
54
|
+
ResponsesModel
|
|
55
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
ResponseChannelId: {
|
|
28
|
+
type: types.UUID,
|
|
29
|
+
allowNull: true,
|
|
30
|
+
references: {
|
|
31
|
+
model: 'ResponseChannels',
|
|
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
|
+
return ResponsesBoxes
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
module.exports = {
|
|
58
|
+
RESPONSE_BOXES_TYPE,
|
|
59
|
+
RESPONSE_BOXES_TYPES,
|
|
60
|
+
ResponsesBoxesModel
|
|
61
|
+
}
|