@itleanchatbot/shared-models-js-postgres 1.5.91 → 2.1.0
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 +28 -3
- package/package.json +8 -2
- package/src/migrations/2021050204551-create-extension-uuid-ossp.js +12 -0
- package/src/migrations/20210503140511-create-channel-types.js +56 -0
- package/src/migrations/20210503141113-create-channel-configurations.js +56 -0
- package/src/migrations/20210503141528-create-enterprises.js +47 -0
- package/src/migrations/20210503142049-create-permissions.js.js +44 -0
- package/src/migrations/20210503142205-create-profiles.js.js +33 -0
- package/src/migrations/20210503142259-create-profiles-permissions.js +45 -0
- package/src/migrations/20210503142433-create-system-users.js +61 -0
- package/src/migrations/20210503142528-create-system-users-profiles.js +45 -0
- package/src/migrations/20210503142645-create-departments.js +49 -0
- package/src/migrations/20210503142739-create-clients.js +44 -0
- package/src/migrations/20210503142857-create-intelligences.js +48 -0
- package/src/migrations/20210503142959-create-ibm-providers.js +71 -0
- package/src/migrations/20210503151909-create-itlean-providers.js +53 -0
- package/src/migrations/20210503154612-create-skills.js +114 -0
- package/src/migrations/20210503161006-create-files.js +53 -0
- package/src/migrations/20210503161236-create-channels.js +66 -0
- package/src/migrations/20210503161308-create-sessions.js +67 -0
- package/src/migrations/20210503161503-create-subdepartments.js +49 -0
- package/src/migrations/20210503161543-create-branches.js +53 -0
- package/src/migrations/20210503161909-create-lines.js +55 -0
- package/src/migrations/20210503161947-create-entities.js +56 -0
- package/src/migrations/20210503162126-create-intentions.js +56 -0
- package/src/migrations/20210503162213-create-intentions-values.js +51 -0
- package/src/migrations/20210503162618-create-entities-values.js +67 -0
- package/src/migrations/20210503162752-create-synonyms.js +71 -0
- package/src/migrations/20210503163331-create-responses.js +58 -0
- package/src/migrations/20210503163437-create-responses-boxes.js +66 -0
- package/src/migrations/20210503163702-create-languages.js +42 -0
- package/src/migrations/20210503184109-create-groups.js +53 -0
- package/src/migrations/20210503185846-create-contacts.js +55 -0
- package/src/migrations/20210503190220-create-groups-contacts.js +47 -0
- package/src/migrations/20210503190338-create-fields.js +40 -0
- package/src/migrations/20210503190515-create-apis.js +65 -0
- package/src/migrations/20210503191041-create-apis-resources-body.js +46 -0
- package/src/migrations/20210503191107-create-apis-resources.js +74 -0
- package/src/migrations/20210503191253-create-apis-resources-headers.js +53 -0
- package/src/migrations/20210503193228-create-apis-resources-query-string-params.js +61 -0
- package/src/migrations/20210503193425-create-apis-resources-path-params.js +52 -0
- package/src/migrations/20210503193511-create-dialog-nodes.js +121 -0
- package/src/migrations/20210503193629-create-response-dialog-nodes.js +46 -0
- package/src/migrations/20210503193905-create-system-users-lines.js +45 -0
- package/src/migrations/20210503194004-create-attendances.js +80 -0
- package/src/migrations/20210503194036-create-tranship-conversations.js +65 -0
- package/src/migrations/20210503194204-create-line-configurations.js +75 -0
- package/src/migrations/20210504133611-create-templates.js +68 -0
- package/src/migrations/20210504133647-create-socket-clients.js +73 -0
- package/src/migrations/20210504143703-create-dialog-nodes-multiple-responses.js +47 -0
- package/src/migrations/20210504144332-create-messages-hsm.js +72 -0
- package/src/migrations/20210504144657-create-dialog-nodes-api-resources.js +54 -0
- package/src/migrations/20210504144730-create-send-hsm.js +62 -0
- package/src/migrations/20210504144859-create-messages-hsm-channels.js +48 -0
- package/src/migrations/20210504144931-create-open-faqs.js +55 -0
- package/src/migrations/20210504145032-create-return-hsm.js +50 -0
- package/src/migrations/20210504160623-create-group-send-hsm.js +52 -0
- package/src/migrations/20210504164445-create-extension-unaccent.js +11 -0
- package/src/migrations/20210504164516-create-extension-fuzzy.js +11 -0
- package/src/migrations/20210504164553-create-attendance-scale.js +48 -0
- package/src/migrations/20210504164613-create-attendance-scale-off.js +58 -0
- package/src/migrations/20210504165351-create-comments.js +42 -0
- package/src/migrations/20210504165421-create-quick-messages.js +49 -0
- package/src/migrations/20210504165514-create-bot-iterables.js +60 -0
- package/src/migrations/20210504165900-create-tranship-triggers.js +114 -0
- package/src/migrations/20210505025504-create-send-hsm-return-hsm.js +34 -0
- package/src/migrations/20210507012938-create-faq-triggers.js +68 -0
- package/src/migrations/20210518122431-alter-responses.js +17 -0
- package/src/migrations/20210524150418-create-faq-questions.js +51 -0
- package/src/migrations/20210524173157-alter-table-open-faq.js +17 -0
- package/src/migrations/20210526115430-alter-attendances.js +14 -0
- package/src/migrations/20210528101030-alter-attendances.js +82 -0
- package/src/migrations/20210609103918-create-table-postbakGupshup.js +46 -0
- package/src/migrations/20210614194609-alter-channels.js +14 -0
- package/src/migrations/20210618101840-alter-table-MessagesHsms.js +14 -0
- package/src/migrations/20210622132643-alter-table-postbackGupshup.js +11 -0
- package/src/migrations/20210623110159-alter-table-botinterable.js +176 -0
- package/src/migrations/20210623180356-alter-dialog-nodes-api-resources.js +15 -0
- package/src/migrations/20210625165930-alter-dialog-nodes-api-resources.js +15 -0
- package/src/migrations/20210708142712-alter-table-entity-values.js +17 -0
- package/src/migrations/20210708145259-alter-table-synonyms.js +25 -0
- package/src/migrations/20210719161230-alter-attendances.js +14 -0
- package/src/migrations/20210727095921-alter-name-size.js +39 -0
- package/src/migrations/20210727110430-create-endSessionTriggers.js +71 -0
- package/src/migrations/20210728140327-create-table-online-editing.js +42 -0
- package/src/migrations/20210810152747-alter-botIterables.js +26 -0
- package/src/migrations/20210812110330-create-indexes.js +101 -0
- package/src/migrations/20210816124430-create-inactivityTriggers.js +60 -0
- package/src/migrations/20210819155330-create-function.js +123 -0
- package/src/migrations/20210823145424-remove-names-botiterables.js +74 -0
- package/src/migrations/20210902145430-create-apiKeys.js +40 -0
- package/src/migrations/20210906092430-create-customPostback.js +44 -0
- package/src/migrations/20210906144034-alter-api-body-migration.js +74 -0
- package/src/migrations/20210910081430-create-transhipInactivityTriggers.js +48 -0
- package/src/migrations/20210923131530-alter-attendances.js +14 -0
- package/src/migrations/20210923140130-create-function.js +85 -0
- package/src/migrations/20210927141630-alter-attendances.js +32 -0
- package/src/migrations/20211020130541-alter-table-session-hasTranship.js +14 -0
- package/src/migrations/20211025155825-create-stopwords.js +52 -0
- package/src/{apiKeys.js → models/apiKeys.js} +1 -1
- package/src/{apiResourceBodies.js → models/apiResourceBodies.js} +1 -1
- package/src/{apiResourceHeaders.js → models/apiResourceHeaders.js} +1 -1
- package/src/{apiResourcePathParams.js → models/apiResourcePathParams.js} +1 -1
- package/src/{apiResourceQueryStringParams.js → models/apiResourceQueryStringParams.js} +1 -1
- package/src/{apiResources.js → models/apiResources.js} +1 -1
- package/src/{apis.js → models/apis.js} +1 -1
- package/src/{attendanceScale.js → models/attendanceScale.js} +1 -1
- package/src/{attendanceScaleOff.js → models/attendanceScaleOff.js} +1 -1
- package/src/{attendances.js → models/attendances.js} +1 -1
- package/src/{botIterable.js → models/botIterable.js} +1 -5
- package/src/{branches.js → models/branches.js} +1 -1
- package/src/{channelConfigurations.js → models/channelConfigurations.js} +1 -1
- package/src/{channelTypes.js → models/channelTypes.js} +15 -1
- package/src/{channels.js → models/channels.js} +1 -1
- package/src/{client.js → models/client.js} +1 -1
- package/src/{comments.js → models/comments.js} +1 -1
- package/src/models/contacts.js +41 -0
- package/src/{customPostbacks.js → models/customPostbacks.js} +1 -1
- package/src/{departments.js → models/departments.js} +1 -1
- package/src/{dialogNodes.js → models/dialogNodes.js} +1 -1
- package/src/{dialogNodes_MultipleResponses.js → models/dialogNodes_MultipleResponses.js} +1 -1
- package/src/{dialogNodes_apiResources.js → models/dialogNodes_apiResources.js} +1 -1
- package/src/{endSessionTriggers.js → models/endSessionTriggers.js} +1 -1
- package/src/{enterprises.js → models/enterprises.js} +1 -1
- package/src/{entity.js → models/entity.js} +1 -1
- package/src/{entityValues.js → models/entityValues.js} +1 -1
- package/src/{faqQuestions.js → models/faqQuestions.js} +1 -1
- package/src/{faqTriggers.js → models/faqTriggers.js} +1 -1
- package/src/models/fields.js +28 -0
- package/src/{files.js → models/files.js} +1 -1
- package/src/models/groups.js +45 -0
- package/src/models/groupsContracts.js +13 -0
- package/src/models/groupsSendHsms.js +13 -0
- package/src/{ibmProvider.js → models/ibmProvider.js} +1 -1
- package/src/{inactivityTriggers.js → models/inactivityTriggers.js} +1 -1
- package/src/models/index.js +45 -0
- package/src/{intelligence.js → models/intelligence.js} +1 -1
- package/src/{intention.js → models/intention.js} +1 -1
- package/src/{intentionValue.js → models/intentionValue.js} +1 -1
- package/src/{itleanProvider.js → models/itleanProvider.js} +1 -1
- package/src/models/language.js +21 -0
- package/src/{lineConfigurations.js → models/lineConfigurations.js} +1 -1
- package/src/{lines.js → models/lines.js} +1 -1
- package/src/{messagesHsm.js → models/messagesHsm.js} +6 -2
- package/src/models/onlineEditions.js +27 -0
- package/src/{openFaqs.js → models/openFaqs.js} +1 -1
- package/src/{permissions.js → models/permissions.js} +1 -1
- package/src/{postbackGupshup.js → models/postbackGupshup.js} +1 -1
- package/src/{profile.js → models/profile.js} +1 -1
- package/src/{profiles_permission.js → models/profiles_permission.js} +1 -1
- package/src/{quickMessages.js → models/quickMessages.js} +1 -1
- package/src/models/responseChannels.js +39 -0
- package/src/{response_DialogNodes.js → models/response_DialogNodes.js} +1 -1
- package/src/{responses.js → models/responses.js} +1 -1
- package/src/{responsesBoxes.js → models/responsesBoxes.js} +1 -1
- package/src/{returnHsm.js → models/returnHsm.js} +1 -1
- package/src/models/sendHsm.js +51 -0
- package/src/models/sendHsmReturnHsm.js +13 -0
- package/src/{sessions.js → models/sessions.js} +1 -1
- package/src/{skill.js → models/skill.js} +1 -1
- package/src/{socketClients.js → models/socketClients.js} +1 -1
- package/src/{stopwords.js → models/stopwords.js} +1 -1
- package/src/{subDepartments.js → models/subDepartments.js} +1 -1
- package/src/{synonyms.js → models/synonyms.js} +1 -1
- package/src/{systemUsers.js → models/systemUsers.js} +1 -1
- package/src/{systemUsers_Lines.js → models/systemUsers_Lines.js} +1 -1
- package/src/{systemUsers_profiles.js → models/systemUsers_profiles.js} +1 -1
- package/src/{templates.js → models/templates.js} +1 -1
- package/src/{transhipConversations.js → models/transhipConversations.js} +1 -1
- package/src/{transhipInactivityTriggers.js → models/transhipInactivityTriggers.js} +1 -1
- package/src/{transhipTriggers.js → models/transhipTriggers.js} +1 -1
- package/src/presenters/database/migrationHelpers.js +62 -0
- package/src/presenters/encryptation.js +14 -0
- package/src/seeders/20210414180447-change-ChannelTypes.js +47 -0
- package/src/seeders/20210505130137-insert-channel-types.js +65 -0
- package/src/seeders/20210505132612-insert-intelligence.js +27 -0
- package/src/seeders/20210505134121-insert-enterprise.js +15 -0
- package/src/seeders/20210505134345-insert-permissions.js +125 -0
- package/src/seeders/20210505134549-insert-profiles.js +39 -0
- package/src/seeders/20210505134700-insert-profiles-permissions.js +80 -0
- package/src/seeders/20210505135931-insert-system-users.js +52 -0
- package/src/seeders/20210505140025-insert-system-users-profiles.js +26 -0
- package/src/seeders/20210505140049-insert-language.js +21 -0
- package/src/seeders/20210505140259-insert-itlean-provider.js +34 -0
- package/src/seeders/20210505140343-insert-templates.js +228 -0
- package/src/seeders/20210505140658-insert-channel-configurations.js +146 -0
- package/src/seeders/20210618132740-add-new-channel-configutations.js +45 -0
- package/src/seeders/20210817081230-insert-profiles-permissions.js +105 -0
- package/src/seeders/20210830131930-insert-profiles-permissions.js +71 -0
- package/src/seeders/20210902160430-insert-apiKey.js +30 -0
- package/src/seeders/20211005135921-edit-gupshup-reponseTypes.js +47 -0
- package/index.js +0 -125
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
ENTITY_VALUES_TYPE,
|
|
5
|
+
ENTITY_VALUES_TYPES,
|
|
6
|
+
} = require('./../models/entityValues')
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
up: async (queryInterface, Sequelize) => {
|
|
10
|
+
await queryInterface.createTable('EntityValues', {
|
|
11
|
+
id: {
|
|
12
|
+
allowNull: false,
|
|
13
|
+
defaultValue: Sequelize.literal('uuid_generate_v4()'),
|
|
14
|
+
primaryKey: true,
|
|
15
|
+
type: Sequelize.UUID,
|
|
16
|
+
},
|
|
17
|
+
EntityId: {
|
|
18
|
+
type: Sequelize.UUID,
|
|
19
|
+
allowNull: false,
|
|
20
|
+
references: {
|
|
21
|
+
model: 'Entities',
|
|
22
|
+
key: 'id',
|
|
23
|
+
},
|
|
24
|
+
onDelete: 'CASCADE',
|
|
25
|
+
onUpdate: 'CASCADE',
|
|
26
|
+
foreignKeyConstraint: true,
|
|
27
|
+
validate: {
|
|
28
|
+
notEmpty: true,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
name: {
|
|
32
|
+
type: Sequelize.STRING(50),
|
|
33
|
+
allowNull: false,
|
|
34
|
+
validate: {
|
|
35
|
+
notEmpty: true,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
synonyms: {
|
|
39
|
+
allowNull: true,
|
|
40
|
+
type: Sequelize.STRING,
|
|
41
|
+
},
|
|
42
|
+
type: {
|
|
43
|
+
type: Sequelize.ENUM({
|
|
44
|
+
values: ENTITY_VALUES_TYPE,
|
|
45
|
+
}),
|
|
46
|
+
allowNull: false,
|
|
47
|
+
defaultValue: ENTITY_VALUES_TYPES.SYNONYM,
|
|
48
|
+
},
|
|
49
|
+
createdAt: {
|
|
50
|
+
allowNull: false,
|
|
51
|
+
type: Sequelize.DATE,
|
|
52
|
+
},
|
|
53
|
+
updatedAt: {
|
|
54
|
+
allowNull: false,
|
|
55
|
+
type: Sequelize.DATE,
|
|
56
|
+
},
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
await queryInterface.addIndex('EntityValues', ['name'], {
|
|
60
|
+
indexName: 'entityValuesName',
|
|
61
|
+
})
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
down: async (queryInterface, Sequelize) => {
|
|
65
|
+
await queryInterface.dropTable('EntityValues')
|
|
66
|
+
},
|
|
67
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { SYNONYMS_TYPE, SYNONYMS_TYPES } = require('./../models/synonyms')
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
up: async (queryInterface, Sequelize) => {
|
|
7
|
+
await queryInterface.createTable('Synonyms', {
|
|
8
|
+
id: {
|
|
9
|
+
allowNull: false,
|
|
10
|
+
defaultValue: Sequelize.literal('uuid_generate_v4()'),
|
|
11
|
+
primaryKey: true,
|
|
12
|
+
type: Sequelize.UUID,
|
|
13
|
+
},
|
|
14
|
+
EntityId: {
|
|
15
|
+
type: Sequelize.UUID,
|
|
16
|
+
allowNull: false,
|
|
17
|
+
references: {
|
|
18
|
+
model: 'Entities',
|
|
19
|
+
key: 'id',
|
|
20
|
+
},
|
|
21
|
+
onDelete: 'CASCADE',
|
|
22
|
+
onUpdate: 'CASCADE',
|
|
23
|
+
foreignKeyConstraint: true,
|
|
24
|
+
validate: {
|
|
25
|
+
notEmpty: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
EntityValueId: {
|
|
29
|
+
type: Sequelize.UUID,
|
|
30
|
+
allowNull: false,
|
|
31
|
+
references: {
|
|
32
|
+
model: 'EntityValues',
|
|
33
|
+
key: 'id',
|
|
34
|
+
},
|
|
35
|
+
onDelete: 'CASCADE',
|
|
36
|
+
onUpdate: 'CASCADE',
|
|
37
|
+
foreignKeyConstraint: true,
|
|
38
|
+
validate: {
|
|
39
|
+
notEmpty: true,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
name: {
|
|
43
|
+
type: Sequelize.STRING(50),
|
|
44
|
+
index: true,
|
|
45
|
+
allowNull: false,
|
|
46
|
+
validate: {
|
|
47
|
+
notEmpty: true,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
type: {
|
|
51
|
+
type: Sequelize.ENUM({
|
|
52
|
+
values: SYNONYMS_TYPE,
|
|
53
|
+
}),
|
|
54
|
+
allowNull: false,
|
|
55
|
+
defaultValue: SYNONYMS_TYPES.SYNONYM,
|
|
56
|
+
},
|
|
57
|
+
createdAt: {
|
|
58
|
+
allowNull: false,
|
|
59
|
+
type: Sequelize.DATE,
|
|
60
|
+
},
|
|
61
|
+
updatedAt: {
|
|
62
|
+
allowNull: false,
|
|
63
|
+
type: Sequelize.DATE,
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
down: async (queryInterface, Sequelize) => {
|
|
69
|
+
await queryInterface.dropTable('Synonyms')
|
|
70
|
+
},
|
|
71
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
await queryInterface.createTable('Responses', {
|
|
6
|
+
id: {
|
|
7
|
+
allowNull: false,
|
|
8
|
+
defaultValue: Sequelize.literal('uuid_generate_v4()'),
|
|
9
|
+
primaryKey: true,
|
|
10
|
+
type: Sequelize.UUID,
|
|
11
|
+
},
|
|
12
|
+
SkillId: {
|
|
13
|
+
type: Sequelize.UUID,
|
|
14
|
+
allowNull: false,
|
|
15
|
+
references: {
|
|
16
|
+
model: 'Skills',
|
|
17
|
+
key: 'id',
|
|
18
|
+
},
|
|
19
|
+
onDelete: 'RESTRICT',
|
|
20
|
+
onUpdate: 'CASCADE',
|
|
21
|
+
foreignKeyConstraint: true,
|
|
22
|
+
validate: {
|
|
23
|
+
notEmpty: true,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
name: {
|
|
27
|
+
type: Sequelize.STRING(255),
|
|
28
|
+
allowNull: false,
|
|
29
|
+
validate: {
|
|
30
|
+
notEmpty: true,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
type: {
|
|
34
|
+
type: Sequelize.STRING(50),
|
|
35
|
+
allowNull: true,
|
|
36
|
+
},
|
|
37
|
+
createdAt: {
|
|
38
|
+
allowNull: false,
|
|
39
|
+
type: Sequelize.DATE,
|
|
40
|
+
},
|
|
41
|
+
updatedAt: {
|
|
42
|
+
allowNull: false,
|
|
43
|
+
type: Sequelize.DATE,
|
|
44
|
+
},
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
await queryInterface.addIndex('Responses', ['name'], {
|
|
48
|
+
indexName: 'responsesName',
|
|
49
|
+
})
|
|
50
|
+
await queryInterface.addIndex('Responses', ['type'], {
|
|
51
|
+
indexName: 'responsesType',
|
|
52
|
+
})
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
down: async (queryInterface, Sequelize) => {
|
|
56
|
+
await queryInterface.dropTable('Responses')
|
|
57
|
+
},
|
|
58
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
RESPONSE_BOXES_TYPE,
|
|
5
|
+
RESPONSE_BOXES_TYPES,
|
|
6
|
+
} = require('./../models/responsesBoxes')
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
up: async (queryInterface, Sequelize) => {
|
|
10
|
+
await queryInterface.createTable('ResponsesBoxes', {
|
|
11
|
+
id: {
|
|
12
|
+
allowNull: false,
|
|
13
|
+
defaultValue: Sequelize.literal('uuid_generate_v4()'),
|
|
14
|
+
primaryKey: true,
|
|
15
|
+
type: Sequelize.UUID,
|
|
16
|
+
},
|
|
17
|
+
ResponseId: {
|
|
18
|
+
type: Sequelize.UUID,
|
|
19
|
+
allowNull: false,
|
|
20
|
+
references: {
|
|
21
|
+
model: 'Responses',
|
|
22
|
+
key: 'id',
|
|
23
|
+
},
|
|
24
|
+
onDelete: 'RESTRICT',
|
|
25
|
+
onUpdate: 'CASCADE',
|
|
26
|
+
foreignKeyConstraint: true,
|
|
27
|
+
validate: {
|
|
28
|
+
notEmpty: true,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
ChannelTypeId: {
|
|
32
|
+
type: Sequelize.UUID,
|
|
33
|
+
references: {
|
|
34
|
+
model: 'ChannelTypes',
|
|
35
|
+
key: 'id',
|
|
36
|
+
},
|
|
37
|
+
onDelete: 'RESTRICT',
|
|
38
|
+
onUpdate: 'CASCADE',
|
|
39
|
+
foreignKeyConstraint: true,
|
|
40
|
+
allowNull: true,
|
|
41
|
+
},
|
|
42
|
+
payload: {
|
|
43
|
+
allowNull: false,
|
|
44
|
+
type: Sequelize.TEXT,
|
|
45
|
+
},
|
|
46
|
+
type: {
|
|
47
|
+
type: Sequelize.ENUM({
|
|
48
|
+
values: RESPONSE_BOXES_TYPE,
|
|
49
|
+
}),
|
|
50
|
+
allowNull: false,
|
|
51
|
+
defaultValue: RESPONSE_BOXES_TYPES.FLOW,
|
|
52
|
+
},
|
|
53
|
+
createdAt: {
|
|
54
|
+
allowNull: false,
|
|
55
|
+
type: Sequelize.DATE,
|
|
56
|
+
},
|
|
57
|
+
updatedAt: {
|
|
58
|
+
allowNull: false,
|
|
59
|
+
type: Sequelize.DATE,
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
},
|
|
63
|
+
down: async (queryInterface, Sequelize) => {
|
|
64
|
+
await queryInterface.dropTable('ResponsesBoxes')
|
|
65
|
+
},
|
|
66
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
await queryInterface.createTable('Languages', {
|
|
6
|
+
id: {
|
|
7
|
+
allowNull: false,
|
|
8
|
+
defaultValue: Sequelize.literal('uuid_generate_v4()'),
|
|
9
|
+
primaryKey: true,
|
|
10
|
+
type: Sequelize.UUID,
|
|
11
|
+
},
|
|
12
|
+
label: {
|
|
13
|
+
type: Sequelize.STRING(255),
|
|
14
|
+
index: true,
|
|
15
|
+
allowNull: false,
|
|
16
|
+
validate: {
|
|
17
|
+
notEmpty: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
value: {
|
|
21
|
+
type: Sequelize.STRING(100),
|
|
22
|
+
index: true,
|
|
23
|
+
allowNull: false,
|
|
24
|
+
validate: {
|
|
25
|
+
notEmpty: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
createdAt: {
|
|
29
|
+
allowNull: false,
|
|
30
|
+
type: Sequelize.DATE,
|
|
31
|
+
},
|
|
32
|
+
updatedAt: {
|
|
33
|
+
allowNull: false,
|
|
34
|
+
type: Sequelize.DATE,
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
down: async (queryInterface, Sequelize) => {
|
|
40
|
+
await queryInterface.dropTable('Languages')
|
|
41
|
+
},
|
|
42
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
await queryInterface.createTable('Groups', {
|
|
6
|
+
id: {
|
|
7
|
+
allowNull: false,
|
|
8
|
+
defaultValue: Sequelize.literal('uuid_generate_v4()'),
|
|
9
|
+
primaryKey: true,
|
|
10
|
+
type: Sequelize.UUID,
|
|
11
|
+
},
|
|
12
|
+
EnterpriseId: {
|
|
13
|
+
type: Sequelize.UUID,
|
|
14
|
+
allowNull: false,
|
|
15
|
+
references: {
|
|
16
|
+
model: 'Enterprises',
|
|
17
|
+
key: 'id',
|
|
18
|
+
},
|
|
19
|
+
onDelete: 'RESTRICT',
|
|
20
|
+
onUpdate: 'CASCADE',
|
|
21
|
+
},
|
|
22
|
+
name: {
|
|
23
|
+
allowNull: false,
|
|
24
|
+
unique: true,
|
|
25
|
+
type: Sequelize.STRING(50),
|
|
26
|
+
validate: {
|
|
27
|
+
notEmpty: true,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
description: {
|
|
31
|
+
allowNull: true,
|
|
32
|
+
type: Sequelize.STRING,
|
|
33
|
+
},
|
|
34
|
+
allSelected: {
|
|
35
|
+
type: Sequelize.BOOLEAN,
|
|
36
|
+
allowNull: true,
|
|
37
|
+
defaultValue: false,
|
|
38
|
+
},
|
|
39
|
+
createdAt: {
|
|
40
|
+
allowNull: false,
|
|
41
|
+
type: Sequelize.DATE,
|
|
42
|
+
},
|
|
43
|
+
updatedAt: {
|
|
44
|
+
allowNull: false,
|
|
45
|
+
type: Sequelize.DATE,
|
|
46
|
+
},
|
|
47
|
+
})
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
down: async (queryInterface, Sequelize) => {
|
|
51
|
+
await queryInterface.dropTable('Groups')
|
|
52
|
+
},
|
|
53
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
await queryInterface.createTable('Contacts', {
|
|
6
|
+
id: {
|
|
7
|
+
allowNull: false,
|
|
8
|
+
defaultValue: Sequelize.literal('uuid_generate_v4()'),
|
|
9
|
+
primaryKey: true,
|
|
10
|
+
type: Sequelize.UUID,
|
|
11
|
+
},
|
|
12
|
+
EnterpriseId: {
|
|
13
|
+
type: Sequelize.UUID,
|
|
14
|
+
allowNull: false,
|
|
15
|
+
references: {
|
|
16
|
+
model: 'Enterprises',
|
|
17
|
+
key: 'id',
|
|
18
|
+
},
|
|
19
|
+
onDelete: 'RESTRICT',
|
|
20
|
+
onUpdate: 'CASCADE',
|
|
21
|
+
},
|
|
22
|
+
headers: {
|
|
23
|
+
type: Sequelize.JSONB,
|
|
24
|
+
allowNull: true,
|
|
25
|
+
},
|
|
26
|
+
content: {
|
|
27
|
+
allowNull: false,
|
|
28
|
+
unique: true,
|
|
29
|
+
type: Sequelize.JSONB,
|
|
30
|
+
},
|
|
31
|
+
flag: {
|
|
32
|
+
allowNull: true,
|
|
33
|
+
type: Sequelize.BOOLEAN,
|
|
34
|
+
defaultValue: false,
|
|
35
|
+
},
|
|
36
|
+
allSelected: {
|
|
37
|
+
type: Sequelize.BOOLEAN,
|
|
38
|
+
allowNull: true,
|
|
39
|
+
defaultValue: false,
|
|
40
|
+
},
|
|
41
|
+
createdAt: {
|
|
42
|
+
allowNull: false,
|
|
43
|
+
type: Sequelize.DATE,
|
|
44
|
+
},
|
|
45
|
+
updatedAt: {
|
|
46
|
+
allowNull: false,
|
|
47
|
+
type: Sequelize.DATE,
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
down: async (queryInterface, Sequelize) => {
|
|
53
|
+
await queryInterface.dropTable('Contacts')
|
|
54
|
+
},
|
|
55
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
await queryInterface.createTable('GroupsContacts', {
|
|
6
|
+
id: {
|
|
7
|
+
allowNull: false,
|
|
8
|
+
defaultValue: Sequelize.literal('uuid_generate_v4()'),
|
|
9
|
+
primaryKey: true,
|
|
10
|
+
type: Sequelize.UUID,
|
|
11
|
+
},
|
|
12
|
+
GroupId: {
|
|
13
|
+
type: Sequelize.UUID,
|
|
14
|
+
allowNull: false,
|
|
15
|
+
references: {
|
|
16
|
+
model: 'Groups',
|
|
17
|
+
key: 'id',
|
|
18
|
+
},
|
|
19
|
+
foreignKeyConstraint: true,
|
|
20
|
+
onDelete: 'CASCADE',
|
|
21
|
+
onUpdate: 'CASCADE',
|
|
22
|
+
},
|
|
23
|
+
ContactId: {
|
|
24
|
+
type: Sequelize.UUID,
|
|
25
|
+
allowNull: false,
|
|
26
|
+
references: {
|
|
27
|
+
model: 'Contacts',
|
|
28
|
+
key: 'id',
|
|
29
|
+
},
|
|
30
|
+
foreignKeyConstraint: true,
|
|
31
|
+
onDelete: 'CASCADE',
|
|
32
|
+
onUpdate: 'CASCADE',
|
|
33
|
+
},
|
|
34
|
+
createdAt: {
|
|
35
|
+
allowNull: false,
|
|
36
|
+
type: Sequelize.DATE,
|
|
37
|
+
},
|
|
38
|
+
updatedAt: {
|
|
39
|
+
allowNull: false,
|
|
40
|
+
type: Sequelize.DATE,
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
},
|
|
44
|
+
down: async (queryInterface, Sequelize) => {
|
|
45
|
+
await queryInterface.dropTable('GroupsContacts')
|
|
46
|
+
},
|
|
47
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
await queryInterface.createTable('Fields', {
|
|
6
|
+
id: {
|
|
7
|
+
allowNull: false,
|
|
8
|
+
defaultValue: Sequelize.literal('uuid_generate_v4()'),
|
|
9
|
+
primaryKey: true,
|
|
10
|
+
type: Sequelize.UUID,
|
|
11
|
+
},
|
|
12
|
+
EnterpriseId: {
|
|
13
|
+
type: Sequelize.UUID,
|
|
14
|
+
allowNull: false,
|
|
15
|
+
references: {
|
|
16
|
+
model: 'Enterprises',
|
|
17
|
+
key: 'id',
|
|
18
|
+
},
|
|
19
|
+
onDelete: 'RESTRICT',
|
|
20
|
+
onUpdate: 'CASCADE',
|
|
21
|
+
},
|
|
22
|
+
fields: {
|
|
23
|
+
allowNull: false,
|
|
24
|
+
unique: true,
|
|
25
|
+
type: Sequelize.JSONB,
|
|
26
|
+
},
|
|
27
|
+
createdAt: {
|
|
28
|
+
allowNull: false,
|
|
29
|
+
type: Sequelize.DATE,
|
|
30
|
+
},
|
|
31
|
+
updatedAt: {
|
|
32
|
+
allowNull: false,
|
|
33
|
+
type: Sequelize.DATE,
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
},
|
|
37
|
+
down: async (queryInterface, Sequelize) => {
|
|
38
|
+
await queryInterface.dropTable('Fields')
|
|
39
|
+
},
|
|
40
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
API_INTEGRATION_TYPE,
|
|
5
|
+
API_INTEGRATION_TYPES,
|
|
6
|
+
} = require('./../models/apis')
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
up: async (queryInterface, Sequelize) => {
|
|
10
|
+
await queryInterface.createTable('Apis', {
|
|
11
|
+
id: {
|
|
12
|
+
allowNull: false,
|
|
13
|
+
defaultValue: Sequelize.literal('uuid_generate_v4()'),
|
|
14
|
+
primaryKey: true,
|
|
15
|
+
type: Sequelize.UUID,
|
|
16
|
+
},
|
|
17
|
+
EnterpriseId: {
|
|
18
|
+
type: Sequelize.UUID,
|
|
19
|
+
allowNull: true,
|
|
20
|
+
references: {
|
|
21
|
+
model: 'Enterprises',
|
|
22
|
+
key: 'id',
|
|
23
|
+
},
|
|
24
|
+
onDelete: 'RESTRICT',
|
|
25
|
+
onUpdate: 'CASCADE',
|
|
26
|
+
},
|
|
27
|
+
baseUrl: {
|
|
28
|
+
type: Sequelize.JSON,
|
|
29
|
+
defaultValue: null,
|
|
30
|
+
allowNull: true,
|
|
31
|
+
},
|
|
32
|
+
type: {
|
|
33
|
+
type: Sequelize.ENUM({
|
|
34
|
+
values: API_INTEGRATION_TYPE,
|
|
35
|
+
}),
|
|
36
|
+
defaultValue: API_INTEGRATION_TYPES.JSON,
|
|
37
|
+
allowNull: false,
|
|
38
|
+
},
|
|
39
|
+
name: {
|
|
40
|
+
type: Sequelize.STRING,
|
|
41
|
+
allowNull: true,
|
|
42
|
+
},
|
|
43
|
+
description: {
|
|
44
|
+
type: Sequelize.STRING,
|
|
45
|
+
allowNull: true,
|
|
46
|
+
},
|
|
47
|
+
createdAt: {
|
|
48
|
+
allowNull: false,
|
|
49
|
+
type: Sequelize.DATE,
|
|
50
|
+
},
|
|
51
|
+
updatedAt: {
|
|
52
|
+
allowNull: false,
|
|
53
|
+
type: Sequelize.DATE,
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
await queryInterface.addIndex('Apis', ['type'], {
|
|
58
|
+
indexName: 'type',
|
|
59
|
+
})
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
down: async (queryInterface) => {
|
|
63
|
+
return queryInterface.dropTable('Apis')
|
|
64
|
+
},
|
|
65
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
APIS_RESOURCES_BODY_TYPE,
|
|
5
|
+
APIS_RESOURCES_BODY_TYPES,
|
|
6
|
+
} = require('./../models/apiResourceBodies')
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
up: async (queryInterface, Sequelize) => {
|
|
10
|
+
await queryInterface.createTable('ApiResourcesBodies', {
|
|
11
|
+
id: {
|
|
12
|
+
allowNull: false,
|
|
13
|
+
defaultValue: Sequelize.literal('uuid_generate_v4()'),
|
|
14
|
+
primaryKey: true,
|
|
15
|
+
type: Sequelize.UUID,
|
|
16
|
+
},
|
|
17
|
+
content: {
|
|
18
|
+
type: Sequelize.TEXT,
|
|
19
|
+
allowNull: false,
|
|
20
|
+
},
|
|
21
|
+
type: {
|
|
22
|
+
type: Sequelize.ENUM({
|
|
23
|
+
values: APIS_RESOURCES_BODY_TYPE,
|
|
24
|
+
}),
|
|
25
|
+
allowNull: false,
|
|
26
|
+
defaultValue: APIS_RESOURCES_BODY_TYPES.JSON,
|
|
27
|
+
},
|
|
28
|
+
createdAt: {
|
|
29
|
+
allowNull: false,
|
|
30
|
+
type: Sequelize.DATE,
|
|
31
|
+
},
|
|
32
|
+
updatedAt: {
|
|
33
|
+
allowNull: false,
|
|
34
|
+
type: Sequelize.DATE,
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
await queryInterface.addIndex('ApiResourcesBodies', ['type'], {
|
|
39
|
+
indexName: 'typeApiResourcesBodies',
|
|
40
|
+
})
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
down: async (queryInterface) => {
|
|
44
|
+
return queryInterface.dropTable('ApiResourcesBodies')
|
|
45
|
+
},
|
|
46
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { HTTP_METHODS } = require('./../models/apiResources')
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
up: async (queryInterface, Sequelize) => {
|
|
7
|
+
await queryInterface.createTable('ApiResources', {
|
|
8
|
+
id: {
|
|
9
|
+
allowNull: false,
|
|
10
|
+
defaultValue: Sequelize.literal('uuid_generate_v4()'),
|
|
11
|
+
primaryKey: true,
|
|
12
|
+
type: Sequelize.UUID,
|
|
13
|
+
},
|
|
14
|
+
ApiId: {
|
|
15
|
+
type: Sequelize.UUID,
|
|
16
|
+
allowNull: false,
|
|
17
|
+
references: {
|
|
18
|
+
model: 'Apis',
|
|
19
|
+
key: 'id',
|
|
20
|
+
},
|
|
21
|
+
onDelete: 'RESTRICT',
|
|
22
|
+
onUpdate: 'CASCADE',
|
|
23
|
+
},
|
|
24
|
+
ApiResourcesBodyId: {
|
|
25
|
+
type: Sequelize.UUID,
|
|
26
|
+
allowNull: true,
|
|
27
|
+
references: {
|
|
28
|
+
model: 'ApiResourcesBodies',
|
|
29
|
+
key: 'id',
|
|
30
|
+
},
|
|
31
|
+
onDelete: 'RESTRICT',
|
|
32
|
+
onUpdate: 'CASCADE',
|
|
33
|
+
},
|
|
34
|
+
uri: {
|
|
35
|
+
type: Sequelize.STRING,
|
|
36
|
+
allowNull: false,
|
|
37
|
+
},
|
|
38
|
+
method: {
|
|
39
|
+
type: Sequelize.ENUM({
|
|
40
|
+
values: HTTP_METHODS,
|
|
41
|
+
}),
|
|
42
|
+
allowNull: true,
|
|
43
|
+
},
|
|
44
|
+
name: {
|
|
45
|
+
type: Sequelize.STRING,
|
|
46
|
+
allowNull: true,
|
|
47
|
+
},
|
|
48
|
+
description: {
|
|
49
|
+
type: Sequelize.STRING,
|
|
50
|
+
allowNull: true,
|
|
51
|
+
},
|
|
52
|
+
createdAt: {
|
|
53
|
+
allowNull: false,
|
|
54
|
+
type: Sequelize.DATE,
|
|
55
|
+
},
|
|
56
|
+
updatedAt: {
|
|
57
|
+
allowNull: false,
|
|
58
|
+
type: Sequelize.DATE,
|
|
59
|
+
},
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
await queryInterface.addIndex('ApiResources', ['method'], {
|
|
63
|
+
indexName: 'methodApiResources',
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
await queryInterface.addIndex('ApiResources', ['name'], {
|
|
67
|
+
indexName: 'nameApiResources',
|
|
68
|
+
})
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
down: async (queryInterface) => {
|
|
72
|
+
return queryInterface.dropTable('ApiResources')
|
|
73
|
+
},
|
|
74
|
+
}
|