@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/README.md +11 -79
- package/index.js +13 -1
- package/package.json +40 -40
- package/src/attendances.js +70 -70
- package/src/branches.js +47 -47
- package/src/channelConfigurations.js +41 -41
- package/src/channelTypes.js +26 -26
- package/src/channels.js +54 -54
- package/src/comments.js +27 -27
- package/src/departments.js +35 -35
- package/src/dialogNodes.js +118 -0
- package/src/dialogNodes_MultipleResponses.js +39 -0
- package/src/dialogNodes_apiResources.js +36 -0
- package/src/enterprises.js +29 -29
- package/src/entity.js +34 -34
- package/src/entityValues.js +63 -63
- package/src/files.js +35 -35
- package/src/ibmProvider.js +62 -62
- package/src/intelligence.js +45 -45
- package/src/intention.js +36 -36
- package/src/intentionValue.js +31 -31
- package/src/lines.js +48 -48
- package/src/profile.js +23 -23
- package/src/profiles_permission.js +25 -25
- package/src/response_DialogNodes.js +32 -0
- package/src/responses.js +55 -0
- package/src/responsesBoxes.js +61 -0
- package/src/sessions.js +45 -45
- package/src/skill.js +107 -106
- package/src/skill_apiResources.js +31 -31
- package/src/socketClients.js +56 -56
- package/src/subDepartments.js +35 -35
- package/src/synonyms.js +66 -66
- package/src/systemUsers.js +50 -50
- package/src/systemUsers_Lines.js +25 -25
- package/src/systemUsers_profiles.js +25 -25
- package/src/transhipConversations.js +34 -34
package/README.md
CHANGED
|
@@ -1,86 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# NLP #
|
|
2
2
|
|
|
3
|
-
O pacote
|
|
3
|
+
O pacote itlean shared-models-js é exatamente o que o nome sugere, um pacote para deixar os models que são compartilhados entre projetos js
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Info ##
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
<https://www.npmjs.com/package/log4js>
|
|
7
|
+
O projeto que for usar esses models compartilhados vão precisar ter as dependencias da orm instaladas
|
|
9
8
|
|
|
10
|
-
##
|
|
9
|
+
## Get Start ##
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
// pass - LOGGER_LEVEL, LOGGER_TYPE, LOGGER_FILE
|
|
14
|
-
const logger = Factory.getLogger('debug', 'console', '')
|
|
15
|
-
~~~
|
|
11
|
+
Dependendo da estrurura do projeto pode ser necessário criar o arquivo da model no projeto e pegar a implementação do model de dentro do pacote.
|
|
16
12
|
|
|
17
|
-
|
|
13
|
+
Exemplo:
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
[2020-09-18T15:59:00.293] [DEBUG] default - example debug [ { param: 'debug' } ]
|
|
25
|
-
*/
|
|
26
|
-
~~~
|
|
27
|
-
|
|
28
|
-
* Info
|
|
29
|
-
|
|
30
|
-
~~~javascript
|
|
31
|
-
logger.info('example info', [ { param: 'info' } ])
|
|
32
|
-
/*
|
|
33
|
-
Result
|
|
34
|
-
|
|
35
|
-
[2020-09-18T15:59:00.306] [INFO] default - example info [ { param: 'info' } ]
|
|
36
|
-
*/
|
|
37
|
-
~~~
|
|
38
|
-
|
|
39
|
-
* Warn
|
|
40
|
-
|
|
41
|
-
~~~javascript
|
|
42
|
-
logger.warning('example warning', [ { param: 'warning' } ])
|
|
43
|
-
/*
|
|
44
|
-
Result
|
|
45
|
-
|
|
46
|
-
[2020-09-18T15:59:00.307] [WARN] default - example warning [ { param: 'warning' } ]
|
|
47
|
-
*/
|
|
48
|
-
~~~
|
|
49
|
-
|
|
50
|
-
* Error
|
|
51
|
-
|
|
52
|
-
~~~javascript
|
|
53
|
-
logger.error('example error', [ { param: 'error' } ])
|
|
54
|
-
/*
|
|
55
|
-
Result
|
|
56
|
-
|
|
57
|
-
[2020-09-18T15:59:00.307] [ERROR] default - example error [ { param: 'error' } ]
|
|
58
|
-
*/
|
|
59
|
-
~~~
|
|
60
|
-
|
|
61
|
-
* Exception
|
|
62
|
-
|
|
63
|
-
~~~javascript
|
|
64
|
-
logger.exception(new Error('example exception'))
|
|
65
|
-
/*
|
|
66
|
-
Result
|
|
67
|
-
|
|
68
|
-
[2020-09-18T15:59:00.308] [ERROR] default - example exception Error: test to exception
|
|
69
|
-
at Object.it (D:\dev\itlean\packages\logger\test\logger.test.ts:56:19)
|
|
70
|
-
at Object.asyncJestTest (D:\dev\itlean\packages\logger\node_modules\jest-jasmine2\build\jasmineAsyncInstall.js:106:37)
|
|
71
|
-
at resolve (D:\dev\itlean\packages\logger\node_modules\jest-jasmine2\build\queueRunner.js:45:12)
|
|
72
|
-
at new Promise (<anonymous>)
|
|
73
|
-
at mapper (D:\dev\itlean\packages\logger\node_modules\jest-jasmine2\build\queueRunner.js:28:19)
|
|
74
|
-
at promise.then (D:\dev\itlean\packages\logger\node_modules\jest-jasmine2\build\queueRunner.js:75:41)
|
|
75
|
-
at process._tickCallback (internal/process/next_tick.js:68:7)
|
|
76
|
-
*/
|
|
77
|
-
|
|
78
|
-
// usages
|
|
79
|
-
|
|
80
|
-
try {
|
|
81
|
-
const db = new Connection() // throw if fail connection
|
|
82
|
-
}
|
|
83
|
-
catch(e) {
|
|
84
|
-
logger.exception(e)
|
|
85
|
-
}
|
|
86
|
-
~~~
|
|
15
|
+
```js
|
|
16
|
+
const { skill } = require('@itleanchatbot/shared-models-js-postgres')
|
|
17
|
+
module.exports = skill.SkillModel
|
|
18
|
+
```
|
package/index.js
CHANGED
|
@@ -37,6 +37,12 @@ const apiResourceBodies = require('./src/apiResourceBodies')
|
|
|
37
37
|
const apiResourceHeaders = require('./src/apiResourceHeaders')
|
|
38
38
|
const apiResourcePathParams = require('./src/apiResourcePathParams')
|
|
39
39
|
const apiResourceQueryStringParams = require('./src/apiResourceQueryStringParams')
|
|
40
|
+
const dialogNodes = require('./src/dialogNodes')
|
|
41
|
+
const dialogNodes_MultipleResponses = require('./src/dialogNodes_MultipleResponses')
|
|
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')
|
|
40
46
|
|
|
41
47
|
module.exports = {
|
|
42
48
|
attendances,
|
|
@@ -77,5 +83,11 @@ module.exports = {
|
|
|
77
83
|
apiResourceBodies,
|
|
78
84
|
apiResourceHeaders,
|
|
79
85
|
apiResourcePathParams,
|
|
80
|
-
apiResourceQueryStringParams
|
|
86
|
+
apiResourceQueryStringParams,
|
|
87
|
+
dialogNodes,
|
|
88
|
+
dialogNodes_MultipleResponses,
|
|
89
|
+
dialogNodes_apiResources,
|
|
90
|
+
response_DialogNodes,
|
|
91
|
+
responses,
|
|
92
|
+
responsesBoxes
|
|
81
93
|
}
|
package/package.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@itleanchatbot/shared-models-js-postgres",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Shared Models JS Postgres",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"license": "ISC",
|
|
7
|
-
"author": "Wilber da Silva <wilber.costa@itlean.com>",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"lint": "npx eslint \"/**/*.js\" --fix",
|
|
10
|
-
"format": "npm run format:src",
|
|
11
|
-
"format:src": "npx prettier --write \"src/**/*.js\""
|
|
12
|
-
},
|
|
13
|
-
"husky": {
|
|
14
|
-
"hooks": {
|
|
15
|
-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
|
|
16
|
-
"prepare-commit-msg": "exec < /dev/tty && git cz --hook || true"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"config": {
|
|
20
|
-
"commitizen": {
|
|
21
|
-
"path": "./node_modules/cz-conventional-changelog"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"@commitlint/cli": "^11.0.0",
|
|
26
|
-
"@commitlint/config-conventional": "^11.0.0",
|
|
27
|
-
"commitizen": "^4.2.2",
|
|
28
|
-
"cz-conventional-changelog": "^3.3.0",
|
|
29
|
-
"eslint": "^7.15.0",
|
|
30
|
-
"eslint-config-airbnb-base": "^14.2.1",
|
|
31
|
-
"eslint-config-prettier": "^7.0.0",
|
|
32
|
-
"eslint-config-standard": "^16.0.2",
|
|
33
|
-
"eslint-plugin-prettier": "^3.3.0",
|
|
34
|
-
"eslint-plugin-promise": "^4.2.1",
|
|
35
|
-
"husky": "^4.3.6",
|
|
36
|
-
"jest": "^26.6.3",
|
|
37
|
-
"prettier": "^2.2.1"
|
|
38
|
-
},
|
|
39
|
-
"dependencies": {}
|
|
40
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@itleanchatbot/shared-models-js-postgres",
|
|
3
|
+
"version": "1.0.20",
|
|
4
|
+
"description": "Shared Models JS Postgres",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"author": "Wilber da Silva <wilber.costa@itlean.com>",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"lint": "npx eslint \"/**/*.js\" --fix",
|
|
10
|
+
"format": "npm run format:src",
|
|
11
|
+
"format:src": "npx prettier --write \"src/**/*.js\""
|
|
12
|
+
},
|
|
13
|
+
"husky": {
|
|
14
|
+
"hooks": {
|
|
15
|
+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
|
|
16
|
+
"prepare-commit-msg": "exec < /dev/tty && git cz --hook || true"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"config": {
|
|
20
|
+
"commitizen": {
|
|
21
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@commitlint/cli": "^11.0.0",
|
|
26
|
+
"@commitlint/config-conventional": "^11.0.0",
|
|
27
|
+
"commitizen": "^4.2.2",
|
|
28
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
29
|
+
"eslint": "^7.15.0",
|
|
30
|
+
"eslint-config-airbnb-base": "^14.2.1",
|
|
31
|
+
"eslint-config-prettier": "^7.0.0",
|
|
32
|
+
"eslint-config-standard": "^16.0.2",
|
|
33
|
+
"eslint-plugin-prettier": "^3.3.0",
|
|
34
|
+
"eslint-plugin-promise": "^4.2.1",
|
|
35
|
+
"husky": "^4.3.6",
|
|
36
|
+
"jest": "^26.6.3",
|
|
37
|
+
"prettier": "^2.2.1"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {}
|
|
40
|
+
}
|
package/src/attendances.js
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
exports.AttendancesModel = (sequelize, DataTypes) => {
|
|
2
|
-
const Attendances = sequelize.define('Attendances', {
|
|
3
|
-
SessionId: {
|
|
4
|
-
type: DataTypes.UUID,
|
|
5
|
-
allowNull: false,
|
|
6
|
-
references: {
|
|
7
|
-
model: 'Sessions',
|
|
8
|
-
key: 'id',
|
|
9
|
-
},
|
|
10
|
-
onDelete: 'RESTRICT',
|
|
11
|
-
onUpdate: 'CASCADE',
|
|
12
|
-
},
|
|
13
|
-
LineId: {
|
|
14
|
-
type: DataTypes.UUID,
|
|
15
|
-
allowNull: false,
|
|
16
|
-
references: {
|
|
17
|
-
model: 'Lines',
|
|
18
|
-
key: 'id',
|
|
19
|
-
},
|
|
20
|
-
onDelete: 'RESTRICT',
|
|
21
|
-
onUpdate: 'CASCADE',
|
|
22
|
-
},
|
|
23
|
-
SystemUserId: {
|
|
24
|
-
type: DataTypes.UUID,
|
|
25
|
-
allowNull: true,
|
|
26
|
-
references: {
|
|
27
|
-
model: 'SystemUsers',
|
|
28
|
-
key: 'id',
|
|
29
|
-
},
|
|
30
|
-
onDelete: 'RESTRICT',
|
|
31
|
-
onUpdate: 'CASCADE',
|
|
32
|
-
},
|
|
33
|
-
status: {
|
|
34
|
-
type: DataTypes.ENUM(['waiting', 'started', 'closed', 'transfered']),
|
|
35
|
-
allowNull: false,
|
|
36
|
-
validate: {
|
|
37
|
-
notEmpty: false,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
startedAt: {
|
|
41
|
-
allowNull: true,
|
|
42
|
-
type: DataTypes.DATE,
|
|
43
|
-
},
|
|
44
|
-
closedAt: {
|
|
45
|
-
allowNull: true,
|
|
46
|
-
type: DataTypes.DATE,
|
|
47
|
-
},
|
|
48
|
-
PreviousAttendanceId: {
|
|
49
|
-
type: DataTypes.UUID,
|
|
50
|
-
allowNull: true,
|
|
51
|
-
references: {
|
|
52
|
-
model: 'Attendances',
|
|
53
|
-
key: 'id',
|
|
54
|
-
},
|
|
55
|
-
onDelete: 'RESTRICT',
|
|
56
|
-
onUpdate: 'CASCADE',
|
|
57
|
-
},
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
Attendances.associate = models => {
|
|
61
|
-
Attendances.belongsTo(models.Sessions)
|
|
62
|
-
Attendances.belongsTo(models.SystemUsers)
|
|
63
|
-
Attendances.belongsTo(models.Lines)
|
|
64
|
-
Attendances.hasMany(models.TranshipConversations)
|
|
65
|
-
Attendances.hasOne(models.Attendances, { as: 'PreviousAttendance' })
|
|
66
|
-
Attendances.hasMany(models.Comments)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return Attendances
|
|
70
|
-
}
|
|
1
|
+
exports.AttendancesModel = (sequelize, DataTypes) => {
|
|
2
|
+
const Attendances = sequelize.define('Attendances', {
|
|
3
|
+
SessionId: {
|
|
4
|
+
type: DataTypes.UUID,
|
|
5
|
+
allowNull: false,
|
|
6
|
+
references: {
|
|
7
|
+
model: 'Sessions',
|
|
8
|
+
key: 'id',
|
|
9
|
+
},
|
|
10
|
+
onDelete: 'RESTRICT',
|
|
11
|
+
onUpdate: 'CASCADE',
|
|
12
|
+
},
|
|
13
|
+
LineId: {
|
|
14
|
+
type: DataTypes.UUID,
|
|
15
|
+
allowNull: false,
|
|
16
|
+
references: {
|
|
17
|
+
model: 'Lines',
|
|
18
|
+
key: 'id',
|
|
19
|
+
},
|
|
20
|
+
onDelete: 'RESTRICT',
|
|
21
|
+
onUpdate: 'CASCADE',
|
|
22
|
+
},
|
|
23
|
+
SystemUserId: {
|
|
24
|
+
type: DataTypes.UUID,
|
|
25
|
+
allowNull: true,
|
|
26
|
+
references: {
|
|
27
|
+
model: 'SystemUsers',
|
|
28
|
+
key: 'id',
|
|
29
|
+
},
|
|
30
|
+
onDelete: 'RESTRICT',
|
|
31
|
+
onUpdate: 'CASCADE',
|
|
32
|
+
},
|
|
33
|
+
status: {
|
|
34
|
+
type: DataTypes.ENUM(['waiting', 'started', 'closed', 'transfered']),
|
|
35
|
+
allowNull: false,
|
|
36
|
+
validate: {
|
|
37
|
+
notEmpty: false,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
startedAt: {
|
|
41
|
+
allowNull: true,
|
|
42
|
+
type: DataTypes.DATE,
|
|
43
|
+
},
|
|
44
|
+
closedAt: {
|
|
45
|
+
allowNull: true,
|
|
46
|
+
type: DataTypes.DATE,
|
|
47
|
+
},
|
|
48
|
+
PreviousAttendanceId: {
|
|
49
|
+
type: DataTypes.UUID,
|
|
50
|
+
allowNull: true,
|
|
51
|
+
references: {
|
|
52
|
+
model: 'Attendances',
|
|
53
|
+
key: 'id',
|
|
54
|
+
},
|
|
55
|
+
onDelete: 'RESTRICT',
|
|
56
|
+
onUpdate: 'CASCADE',
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
Attendances.associate = models => {
|
|
61
|
+
Attendances.belongsTo(models.Sessions)
|
|
62
|
+
Attendances.belongsTo(models.SystemUsers)
|
|
63
|
+
Attendances.belongsTo(models.Lines)
|
|
64
|
+
Attendances.hasMany(models.TranshipConversations)
|
|
65
|
+
Attendances.hasOne(models.Attendances, { as: 'PreviousAttendance' })
|
|
66
|
+
Attendances.hasMany(models.Comments)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return Attendances
|
|
70
|
+
}
|
package/src/branches.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
exports.BranchesModel = (sequelize, DataTypes) => {
|
|
2
|
-
const Branches = sequelize.define('Branches', {
|
|
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
|
-
internalId: {
|
|
14
|
-
allowNull: false,
|
|
15
|
-
type: DataTypes.STRING(50),
|
|
16
|
-
validate: {
|
|
17
|
-
notEmpty: true,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
name: {
|
|
21
|
-
allowNull: false,
|
|
22
|
-
type: DataTypes.STRING(50),
|
|
23
|
-
validate: {
|
|
24
|
-
notEmpty: true,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
phone: {
|
|
28
|
-
allowNull: true,
|
|
29
|
-
type: DataTypes.STRING(50),
|
|
30
|
-
},
|
|
31
|
-
website: {
|
|
32
|
-
allowNull: true,
|
|
33
|
-
type: DataTypes.STRING(255),
|
|
34
|
-
},
|
|
35
|
-
urlApi: {
|
|
36
|
-
allowNull: true,
|
|
37
|
-
type: DataTypes.STRING(255),
|
|
38
|
-
},
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
Branches.associate = models => {
|
|
42
|
-
Branches.belongsTo(models.Enterprises)
|
|
43
|
-
Branches.hasMany(models.Lines)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return Branches
|
|
47
|
-
}
|
|
1
|
+
exports.BranchesModel = (sequelize, DataTypes) => {
|
|
2
|
+
const Branches = sequelize.define('Branches', {
|
|
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
|
+
internalId: {
|
|
14
|
+
allowNull: false,
|
|
15
|
+
type: DataTypes.STRING(50),
|
|
16
|
+
validate: {
|
|
17
|
+
notEmpty: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
name: {
|
|
21
|
+
allowNull: false,
|
|
22
|
+
type: DataTypes.STRING(50),
|
|
23
|
+
validate: {
|
|
24
|
+
notEmpty: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
phone: {
|
|
28
|
+
allowNull: true,
|
|
29
|
+
type: DataTypes.STRING(50),
|
|
30
|
+
},
|
|
31
|
+
website: {
|
|
32
|
+
allowNull: true,
|
|
33
|
+
type: DataTypes.STRING(255),
|
|
34
|
+
},
|
|
35
|
+
urlApi: {
|
|
36
|
+
allowNull: true,
|
|
37
|
+
type: DataTypes.STRING(255),
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
Branches.associate = models => {
|
|
42
|
+
Branches.belongsTo(models.Enterprises)
|
|
43
|
+
Branches.hasMany(models.Lines)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return Branches
|
|
47
|
+
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
exports.ChannelConfigurationsModel = (sequelize, DataTypes) => {
|
|
2
|
-
const ChannelConfigurations = sequelize.define('ChannelConfigurations', {
|
|
3
|
-
ChannelTypeId: {
|
|
4
|
-
type: DataTypes.UUID,
|
|
5
|
-
allowNull: false,
|
|
6
|
-
references: {
|
|
7
|
-
model: 'ChannelTypes',
|
|
8
|
-
key: 'id',
|
|
9
|
-
},
|
|
10
|
-
onDelete: 'RESTRICT',
|
|
11
|
-
onUpdate: 'CASCADE',
|
|
12
|
-
},
|
|
13
|
-
fieldName: {
|
|
14
|
-
type: DataTypes.STRING(50),
|
|
15
|
-
allowNull: false,
|
|
16
|
-
validate: {
|
|
17
|
-
notEmpty: true,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
fieldType: {
|
|
21
|
-
type: DataTypes.STRING(50),
|
|
22
|
-
allowNull: false,
|
|
23
|
-
validate: {
|
|
24
|
-
notEmpty: true,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
fieldLabel: {
|
|
28
|
-
type: DataTypes.STRING(50),
|
|
29
|
-
allowNull: false,
|
|
30
|
-
validate: {
|
|
31
|
-
notEmpty: true,
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
ChannelConfigurations.associate = models => {
|
|
37
|
-
ChannelConfigurations.belongsTo(models.ChannelTypes)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return ChannelConfigurations
|
|
41
|
-
}
|
|
1
|
+
exports.ChannelConfigurationsModel = (sequelize, DataTypes) => {
|
|
2
|
+
const ChannelConfigurations = sequelize.define('ChannelConfigurations', {
|
|
3
|
+
ChannelTypeId: {
|
|
4
|
+
type: DataTypes.UUID,
|
|
5
|
+
allowNull: false,
|
|
6
|
+
references: {
|
|
7
|
+
model: 'ChannelTypes',
|
|
8
|
+
key: 'id',
|
|
9
|
+
},
|
|
10
|
+
onDelete: 'RESTRICT',
|
|
11
|
+
onUpdate: 'CASCADE',
|
|
12
|
+
},
|
|
13
|
+
fieldName: {
|
|
14
|
+
type: DataTypes.STRING(50),
|
|
15
|
+
allowNull: false,
|
|
16
|
+
validate: {
|
|
17
|
+
notEmpty: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
fieldType: {
|
|
21
|
+
type: DataTypes.STRING(50),
|
|
22
|
+
allowNull: false,
|
|
23
|
+
validate: {
|
|
24
|
+
notEmpty: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
fieldLabel: {
|
|
28
|
+
type: DataTypes.STRING(50),
|
|
29
|
+
allowNull: false,
|
|
30
|
+
validate: {
|
|
31
|
+
notEmpty: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
ChannelConfigurations.associate = models => {
|
|
37
|
+
ChannelConfigurations.belongsTo(models.ChannelTypes)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return ChannelConfigurations
|
|
41
|
+
}
|
package/src/channelTypes.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
exports.ChannelTypesModel = (sequelize, DataTypes) => {
|
|
2
|
-
const ChannelTypes = sequelize.define('ChannelTypes', {
|
|
3
|
-
channelName: {
|
|
4
|
-
allowNull: false,
|
|
5
|
-
type: DataTypes.STRING(50),
|
|
6
|
-
unique: true,
|
|
7
|
-
validate: {
|
|
8
|
-
notEmpty: true,
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
channelLabel: {
|
|
12
|
-
allowNull: false,
|
|
13
|
-
type: DataTypes.STRING(50),
|
|
14
|
-
validate: {
|
|
15
|
-
notEmpty: true,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
ChannelTypes.associate = models => {
|
|
21
|
-
ChannelTypes.hasMany(models.ChannelConfigurations)
|
|
22
|
-
ChannelTypes.hasMany(models.Channels)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return ChannelTypes
|
|
26
|
-
}
|
|
1
|
+
exports.ChannelTypesModel = (sequelize, DataTypes) => {
|
|
2
|
+
const ChannelTypes = sequelize.define('ChannelTypes', {
|
|
3
|
+
channelName: {
|
|
4
|
+
allowNull: false,
|
|
5
|
+
type: DataTypes.STRING(50),
|
|
6
|
+
unique: true,
|
|
7
|
+
validate: {
|
|
8
|
+
notEmpty: true,
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
channelLabel: {
|
|
12
|
+
allowNull: false,
|
|
13
|
+
type: DataTypes.STRING(50),
|
|
14
|
+
validate: {
|
|
15
|
+
notEmpty: true,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
ChannelTypes.associate = models => {
|
|
21
|
+
ChannelTypes.hasMany(models.ChannelConfigurations)
|
|
22
|
+
ChannelTypes.hasMany(models.Channels)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return ChannelTypes
|
|
26
|
+
}
|