@itleanchatbot/shared-models-js-postgres 1.5.91 → 2.0.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/package.json +6 -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/20210613125036-unnamed-migration.js +21 -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/models/index.js +45 -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 +229 -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
- /package/src/{apiKeys.js → models/apiKeys.js} +0 -0
- /package/src/{apiResourceBodies.js → models/apiResourceBodies.js} +0 -0
- /package/src/{apiResourceHeaders.js → models/apiResourceHeaders.js} +0 -0
- /package/src/{apiResourcePathParams.js → models/apiResourcePathParams.js} +0 -0
- /package/src/{apiResourceQueryStringParams.js → models/apiResourceQueryStringParams.js} +0 -0
- /package/src/{apiResources.js → models/apiResources.js} +0 -0
- /package/src/{apis.js → models/apis.js} +0 -0
- /package/src/{attendanceScale.js → models/attendanceScale.js} +0 -0
- /package/src/{attendanceScaleOff.js → models/attendanceScaleOff.js} +0 -0
- /package/src/{attendances.js → models/attendances.js} +0 -0
- /package/src/{botIterable.js → models/botIterable.js} +0 -0
- /package/src/{branches.js → models/branches.js} +0 -0
- /package/src/{channelConfigurations.js → models/channelConfigurations.js} +0 -0
- /package/src/{channelTypes.js → models/channelTypes.js} +0 -0
- /package/src/{channels.js → models/channels.js} +0 -0
- /package/src/{client.js → models/client.js} +0 -0
- /package/src/{comments.js → models/comments.js} +0 -0
- /package/src/{customPostbacks.js → models/customPostbacks.js} +0 -0
- /package/src/{departments.js → models/departments.js} +0 -0
- /package/src/{dialogNodes.js → models/dialogNodes.js} +0 -0
- /package/src/{dialogNodes_MultipleResponses.js → models/dialogNodes_MultipleResponses.js} +0 -0
- /package/src/{dialogNodes_apiResources.js → models/dialogNodes_apiResources.js} +0 -0
- /package/src/{endSessionTriggers.js → models/endSessionTriggers.js} +0 -0
- /package/src/{enterprises.js → models/enterprises.js} +0 -0
- /package/src/{entity.js → models/entity.js} +0 -0
- /package/src/{entityValues.js → models/entityValues.js} +0 -0
- /package/src/{faqQuestions.js → models/faqQuestions.js} +0 -0
- /package/src/{faqTriggers.js → models/faqTriggers.js} +0 -0
- /package/src/{files.js → models/files.js} +0 -0
- /package/src/{ibmProvider.js → models/ibmProvider.js} +0 -0
- /package/src/{inactivityTriggers.js → models/inactivityTriggers.js} +0 -0
- /package/src/{intelligence.js → models/intelligence.js} +0 -0
- /package/src/{intention.js → models/intention.js} +0 -0
- /package/src/{intentionValue.js → models/intentionValue.js} +0 -0
- /package/src/{itleanProvider.js → models/itleanProvider.js} +0 -0
- /package/src/{lineConfigurations.js → models/lineConfigurations.js} +0 -0
- /package/src/{lines.js → models/lines.js} +0 -0
- /package/src/{messagesHsm.js → models/messagesHsm.js} +0 -0
- /package/src/{openFaqs.js → models/openFaqs.js} +0 -0
- /package/src/{permissions.js → models/permissions.js} +0 -0
- /package/src/{postbackGupshup.js → models/postbackGupshup.js} +0 -0
- /package/src/{profile.js → models/profile.js} +0 -0
- /package/src/{profiles_permission.js → models/profiles_permission.js} +0 -0
- /package/src/{quickMessages.js → models/quickMessages.js} +0 -0
- /package/src/{response_DialogNodes.js → models/response_DialogNodes.js} +0 -0
- /package/src/{responses.js → models/responses.js} +0 -0
- /package/src/{responsesBoxes.js → models/responsesBoxes.js} +0 -0
- /package/src/{returnHsm.js → models/returnHsm.js} +0 -0
- /package/src/{sessions.js → models/sessions.js} +0 -0
- /package/src/{skill.js → models/skill.js} +0 -0
- /package/src/{socketClients.js → models/socketClients.js} +0 -0
- /package/src/{stopwords.js → models/stopwords.js} +0 -0
- /package/src/{subDepartments.js → models/subDepartments.js} +0 -0
- /package/src/{synonyms.js → models/synonyms.js} +0 -0
- /package/src/{systemUsers.js → models/systemUsers.js} +0 -0
- /package/src/{systemUsers_Lines.js → models/systemUsers_Lines.js} +0 -0
- /package/src/{systemUsers_profiles.js → models/systemUsers_profiles.js} +0 -0
- /package/src/{templates.js → models/templates.js} +0 -0
- /package/src/{transhipConversations.js → models/transhipConversations.js} +0 -0
- /package/src/{transhipInactivityTriggers.js → models/transhipInactivityTriggers.js} +0 -0
- /package/src/{transhipTriggers.js → models/transhipTriggers.js} +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
try {
|
|
6
|
+
const WhatsAppChannelTypes = [
|
|
7
|
+
{ action: 'text', display: 'Texto' },
|
|
8
|
+
{ action: 'image', display: 'Imagem' },
|
|
9
|
+
{ action: 'pdf', display: 'PDF' },
|
|
10
|
+
{ action: 'video', display: 'Vídeo' },
|
|
11
|
+
{ action: 'file', display: 'Arquivo' },
|
|
12
|
+
]
|
|
13
|
+
const WebChatChannelTypes = [
|
|
14
|
+
{ action: 'text', display: 'Texto' },
|
|
15
|
+
{ action: 'image', display: 'Imagem' },
|
|
16
|
+
{ action: 'simple_button', display: 'Botão simples' },
|
|
17
|
+
]
|
|
18
|
+
const DefaultChannelTypes = [{ action: 'text', display: 'Texto' }]
|
|
19
|
+
await queryInterface.sequelize.query(
|
|
20
|
+
`UPDATE "ChannelTypes" SET "responsesTypes" = '${JSON.stringify(
|
|
21
|
+
DefaultChannelTypes
|
|
22
|
+
)}' WHERE "ChannelTypes"."channelName" = 'default'`
|
|
23
|
+
)
|
|
24
|
+
await queryInterface.sequelize.query(
|
|
25
|
+
`UPDATE "ChannelTypes" SET "responsesTypes" = '${JSON.stringify(
|
|
26
|
+
WebChatChannelTypes
|
|
27
|
+
)}' WHERE "ChannelTypes"."channelName" = 'webchat'`
|
|
28
|
+
)
|
|
29
|
+
await queryInterface.sequelize.query(
|
|
30
|
+
`UPDATE "ChannelTypes" SET "responsesTypes" = '${JSON.stringify(
|
|
31
|
+
WhatsAppChannelTypes
|
|
32
|
+
)}' WHERE "ChannelTypes"."channelName" = 'whatsapp_interaxa'`
|
|
33
|
+
)
|
|
34
|
+
return queryInterface.sequelize.query(
|
|
35
|
+
`UPDATE "ChannelTypes" SET "responsesTypes" = '${JSON.stringify(
|
|
36
|
+
WhatsAppChannelTypes
|
|
37
|
+
)}' WHERE "ChannelTypes"."channelName" = 'whatsapp_gupshup'`
|
|
38
|
+
)
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.log('error migration', error)
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
down: async (queryInterface, Sequelize) => {
|
|
45
|
+
return queryInterface.bulkDelete('ChannelTypes', null, {})
|
|
46
|
+
},
|
|
47
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const { CHANNEL_TYPES } = require('../../presenters/constants')
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface) => {
|
|
5
|
+
const WhatsAppChannelTypes = [
|
|
6
|
+
{ action: 'text', display: 'Texto' },
|
|
7
|
+
{ action: 'image', display: 'Imagem' },
|
|
8
|
+
{ action: 'pdf', display: 'PDF' },
|
|
9
|
+
{ action: 'video', display: 'Vídeo' },
|
|
10
|
+
{ action: 'file', display: 'Arquivo' },
|
|
11
|
+
]
|
|
12
|
+
const WebChatChannelTypes = [
|
|
13
|
+
{ action: 'text', display: 'Texto' },
|
|
14
|
+
{ action: 'image', display: 'Imagem' },
|
|
15
|
+
{ action: 'pdf', display: 'PDF' },
|
|
16
|
+
{ action: 'video', display: 'Vídeo' },
|
|
17
|
+
{ action: 'file', display: 'Arquivo' },
|
|
18
|
+
{ action: 'simple_button', display: 'Botão simples' },
|
|
19
|
+
]
|
|
20
|
+
const DefaultChannelTypes = [{ action: 'text', display: 'Texto' }]
|
|
21
|
+
const Default = {
|
|
22
|
+
channelName: CHANNEL_TYPES.DEFAULT,
|
|
23
|
+
channelLabel: 'Padrão',
|
|
24
|
+
responsesTypes: JSON.stringify(DefaultChannelTypes),
|
|
25
|
+
createdAt: new Date(),
|
|
26
|
+
updatedAt: new Date(),
|
|
27
|
+
}
|
|
28
|
+
const webchat = {
|
|
29
|
+
channelName: CHANNEL_TYPES.WEB_CHAT,
|
|
30
|
+
channelLabel: 'WebChat',
|
|
31
|
+
responsesTypes: JSON.stringify(WebChatChannelTypes),
|
|
32
|
+
createdAt: new Date(),
|
|
33
|
+
updatedAt: new Date(),
|
|
34
|
+
}
|
|
35
|
+
const whatsappInteraxa = {
|
|
36
|
+
channelName: CHANNEL_TYPES.WHATSAPP_INTERAXA,
|
|
37
|
+
channelLabel: 'WhatsApp - Interaxa',
|
|
38
|
+
responsesTypes: JSON.stringify(WhatsAppChannelTypes),
|
|
39
|
+
direct_contact_name: 'Whatsapp',
|
|
40
|
+
direct_contact_code: 'whatsapp',
|
|
41
|
+
direct_contact_type: 'number',
|
|
42
|
+
createdAt: new Date(),
|
|
43
|
+
updatedAt: new Date(),
|
|
44
|
+
}
|
|
45
|
+
const whatsappGupshup = {
|
|
46
|
+
channelName: CHANNEL_TYPES.WHATSAPP_GUPSHUP,
|
|
47
|
+
channelLabel: 'WhatsApp - Gupshup',
|
|
48
|
+
responsesTypes: JSON.stringify(WhatsAppChannelTypes),
|
|
49
|
+
direct_contact_name: 'Whatsapp',
|
|
50
|
+
direct_contact_code: 'whatsapp',
|
|
51
|
+
direct_contact_type: 'number',
|
|
52
|
+
createdAt: new Date(),
|
|
53
|
+
updatedAt: new Date(),
|
|
54
|
+
}
|
|
55
|
+
return queryInterface.bulkInsert('ChannelTypes', [
|
|
56
|
+
Default,
|
|
57
|
+
webchat,
|
|
58
|
+
whatsappInteraxa,
|
|
59
|
+
whatsappGupshup,
|
|
60
|
+
])
|
|
61
|
+
},
|
|
62
|
+
down: (queryInterface, Sequelize) => {
|
|
63
|
+
return queryInterface.bulkDelete('ChannelTypes', null, {})
|
|
64
|
+
},
|
|
65
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { PROVIDER_TYPES } = require('../../presenters/constants')
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
up: (queryInterface, Sequelize) => {
|
|
7
|
+
const ibm = {
|
|
8
|
+
name: 'Watson Assistant',
|
|
9
|
+
providerType: PROVIDER_TYPES.IBM,
|
|
10
|
+
visible: true,
|
|
11
|
+
createdAt: new Date(),
|
|
12
|
+
updatedAt: new Date(),
|
|
13
|
+
}
|
|
14
|
+
const itlean = {
|
|
15
|
+
name: 'LeanNLP',
|
|
16
|
+
providerType: PROVIDER_TYPES.ITLEAN,
|
|
17
|
+
visible: true,
|
|
18
|
+
createdAt: new Date(),
|
|
19
|
+
updatedAt: new Date(),
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return queryInterface.bulkInsert('Intelligences', [ibm, itlean])
|
|
23
|
+
},
|
|
24
|
+
down: (queryInterface, Sequelize) => {
|
|
25
|
+
return queryInterface.bulkDelete('Intelligences', null, {})
|
|
26
|
+
},
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
up: (queryInterface, Sequelize) => {
|
|
3
|
+
return queryInterface.bulkInsert('Enterprises', [
|
|
4
|
+
{
|
|
5
|
+
cnpj: process.env.ENTERPRISE_CNPJ,
|
|
6
|
+
name: process.env.ENTERPRISE_NAME,
|
|
7
|
+
createdAt: new Date(),
|
|
8
|
+
updatedAt: new Date(),
|
|
9
|
+
},
|
|
10
|
+
])
|
|
11
|
+
},
|
|
12
|
+
down: (queryInterface, Sequelize) => {
|
|
13
|
+
return queryInterface.bulkDelete('Enterprises', null, {})
|
|
14
|
+
},
|
|
15
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
up: async (queryInterface, Sequelize) => {
|
|
3
|
+
return queryInterface.bulkInsert('Permissions', [
|
|
4
|
+
{
|
|
5
|
+
permissionCode: 'all',
|
|
6
|
+
description: 'Concede acesso a todas as funcionalidades do sistema.',
|
|
7
|
+
createdAt: new Date(),
|
|
8
|
+
updatedAt: new Date(),
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
permissionCode: 'crud_systemUsers',
|
|
12
|
+
description:
|
|
13
|
+
'Permite a criação, leitura, alteração e deleção de usuários do sistema.',
|
|
14
|
+
createdAt: new Date(),
|
|
15
|
+
updatedAt: new Date(),
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
permissionCode: 'crud_departments',
|
|
19
|
+
description:
|
|
20
|
+
'Permite a criação, leitura, alteração e deleção de Departamentos.',
|
|
21
|
+
createdAt: new Date(),
|
|
22
|
+
updatedAt: new Date(),
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
permissionCode: 'crud_subDepartments',
|
|
26
|
+
description:
|
|
27
|
+
'Permite a criação, leitura, alteração e deleção de Sub-Departamentos.',
|
|
28
|
+
createdAt: new Date(),
|
|
29
|
+
updatedAt: new Date(),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
permissionCode: 'crud_branches',
|
|
33
|
+
description:
|
|
34
|
+
'Permite a criação, leitura, alteração e deleção de Filiais.',
|
|
35
|
+
createdAt: new Date(),
|
|
36
|
+
updatedAt: new Date(),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
permissionCode: 'crud_lines',
|
|
40
|
+
description:
|
|
41
|
+
'Permite a criação, leitura, alteração e deleção de Filas de Atendimento.',
|
|
42
|
+
createdAt: new Date(),
|
|
43
|
+
updatedAt: new Date(),
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
permissionCode: 'crud_lineConfigurations',
|
|
47
|
+
description:
|
|
48
|
+
'Permite a leitura e alteração das configurações das Filas de Atendimento.',
|
|
49
|
+
createdAt: new Date(),
|
|
50
|
+
updatedAt: new Date(),
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
permissionCode: 'crud_channels',
|
|
54
|
+
description:
|
|
55
|
+
'Permite a criação, leitura, alteração e deleção de Canais de Atendimento.',
|
|
56
|
+
createdAt: new Date(),
|
|
57
|
+
updatedAt: new Date(),
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
permissionCode: 'crud_attendances',
|
|
61
|
+
description: 'Permite a leitura e alteração de Atendimentos.',
|
|
62
|
+
createdAt: new Date(),
|
|
63
|
+
updatedAt: new Date(),
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
permissionCode: 'crud_quickMessages',
|
|
67
|
+
description:
|
|
68
|
+
'Permite a criação, leitura, alteração e deleção de Mensagens Rápidas.',
|
|
69
|
+
createdAt: new Date(),
|
|
70
|
+
updatedAt: new Date(),
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
permissionCode: 'crud_responses',
|
|
74
|
+
description:
|
|
75
|
+
'Permite a criação, leitura, alteração e deleção de respostas.',
|
|
76
|
+
createdAt: new Date(),
|
|
77
|
+
updatedAt: new Date(),
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
permissionCode: 'crud_openFAQs',
|
|
81
|
+
description:
|
|
82
|
+
'Permite a criação, leitura, alteração e deleção de FAQS abertas.',
|
|
83
|
+
createdAt: new Date(),
|
|
84
|
+
updatedAt: new Date(),
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
permissionCode: 'crud_fields',
|
|
88
|
+
description: 'Permite a leitura e alteração de dicionário de campos.',
|
|
89
|
+
createdAt: new Date(),
|
|
90
|
+
updatedAt: new Date(),
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
permissionCode: 'crud_contacts',
|
|
94
|
+
description:
|
|
95
|
+
'Permite a criação, leitura, alteração e deleção de contatos.',
|
|
96
|
+
createdAt: new Date(),
|
|
97
|
+
updatedAt: new Date(),
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
permissionCode: 'crud_groups',
|
|
101
|
+
description:
|
|
102
|
+
'Permite a criação, leitura, alteração e deleção de grupos.',
|
|
103
|
+
createdAt: new Date(),
|
|
104
|
+
updatedAt: new Date(),
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
permissionCode: 'crud_messagesHsm',
|
|
108
|
+
description:
|
|
109
|
+
'Permite a criação, leitura, alteração e deleção de disparo de mensagens HSM.',
|
|
110
|
+
createdAt: new Date(),
|
|
111
|
+
updatedAt: new Date(),
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
permissionCode: 'crud_sendHsm',
|
|
115
|
+
description:
|
|
116
|
+
'Permite a criação, leitura, alteração e deleção de disparo de HSM.',
|
|
117
|
+
createdAt: new Date(),
|
|
118
|
+
updatedAt: new Date(),
|
|
119
|
+
},
|
|
120
|
+
])
|
|
121
|
+
},
|
|
122
|
+
down: async (queryInterface, Sequelize) => {
|
|
123
|
+
return queryInterface.bulkDelete('Permissions', null, {})
|
|
124
|
+
},
|
|
125
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
up: async (queryInterface, Sequelize) => {
|
|
3
|
+
return queryInterface.bulkInsert('Profiles', [
|
|
4
|
+
{
|
|
5
|
+
name: 'Master',
|
|
6
|
+
createdAt: new Date(),
|
|
7
|
+
updatedAt: new Date(),
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
name: 'Administrador',
|
|
11
|
+
createdAt: new Date(),
|
|
12
|
+
updatedAt: new Date(),
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'Supervisor Desk',
|
|
16
|
+
createdAt: new Date(),
|
|
17
|
+
updatedAt: new Date(),
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'Operador Desk',
|
|
21
|
+
createdAt: new Date(),
|
|
22
|
+
updatedAt: new Date(),
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'Operador Chatbot',
|
|
26
|
+
createdAt: new Date(),
|
|
27
|
+
updatedAt: new Date(),
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'Operador Direct',
|
|
31
|
+
createdAt: new Date(),
|
|
32
|
+
updatedAt: new Date(),
|
|
33
|
+
},
|
|
34
|
+
])
|
|
35
|
+
},
|
|
36
|
+
down: async (queryInterface, Sequelize) => {
|
|
37
|
+
return queryInterface.bulkDelete('Profiles', null, {})
|
|
38
|
+
},
|
|
39
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const models = require('../models')
|
|
2
|
+
const profiles = [
|
|
3
|
+
{
|
|
4
|
+
name: 'Master',
|
|
5
|
+
permissions: ['all'],
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
name: 'Administrador',
|
|
9
|
+
permissions: [
|
|
10
|
+
'crud_lines',
|
|
11
|
+
'crud_systemUsers',
|
|
12
|
+
'crud_responses',
|
|
13
|
+
'crud_openFAQs',
|
|
14
|
+
'crud_fields',
|
|
15
|
+
'crud_contacts',
|
|
16
|
+
'crud_groups',
|
|
17
|
+
'crud_messagesHsm',
|
|
18
|
+
'crud_sendHsm',
|
|
19
|
+
'crud_lineConfigurations',
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Supervisor Desk',
|
|
24
|
+
permissions: ['crud_lineConfigurations', 'crud_quickMessages'],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'Operador Direct',
|
|
28
|
+
permissions: [
|
|
29
|
+
'crud_fields',
|
|
30
|
+
'crud_contacts',
|
|
31
|
+
'crud_groups',
|
|
32
|
+
'crud_messagesHsm',
|
|
33
|
+
'crud_sendHsm',
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'Operador Chatbot',
|
|
38
|
+
permissions: ['crud_responses', 'crud_openFAQs'],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'Operador Desk',
|
|
42
|
+
permissions: ['crud_attendances'],
|
|
43
|
+
},
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
module.exports = {
|
|
47
|
+
up: async (queryInterface, Sequelize) => {
|
|
48
|
+
let prof_per = []
|
|
49
|
+
|
|
50
|
+
for (const prof of profiles) {
|
|
51
|
+
const profId = await queryInterface.rawSelect(
|
|
52
|
+
'Profiles',
|
|
53
|
+
{ where: { name: prof.name } },
|
|
54
|
+
['id']
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
const per = await queryInterface.select(
|
|
58
|
+
models.Permissions,
|
|
59
|
+
'Permissions',
|
|
60
|
+
{ where: { permissionCode: prof.permissions } }
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
prof_per = prof_per.concat(
|
|
64
|
+
per.map((p) => {
|
|
65
|
+
return {
|
|
66
|
+
ProfileId: profId,
|
|
67
|
+
PermissionId: p.dataValues.id,
|
|
68
|
+
createdAt: new Date(),
|
|
69
|
+
updatedAt: new Date(),
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return queryInterface.bulkInsert('Profiles_Permissions', prof_per)
|
|
76
|
+
},
|
|
77
|
+
down: async (queryInterface, Sequelize) => {
|
|
78
|
+
return queryInterface.bulkDelete('Profiles_Permissions', null, {})
|
|
79
|
+
},
|
|
80
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const { encrypt } = require('../../presenters/encryptation')
|
|
2
|
+
const { v4: generateId } = require('uuid')
|
|
3
|
+
const { PROVIDER_TYPES } = require('../../presenters/constants')
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
up: async (queryInterface) => {
|
|
7
|
+
const EnterpriseId = await queryInterface.rawSelect(
|
|
8
|
+
'Enterprises',
|
|
9
|
+
{ where: { cnpj: process.env.ENTERPRISE_CNPJ } },
|
|
10
|
+
['id']
|
|
11
|
+
)
|
|
12
|
+
const IntelligenceId = await queryInterface.rawSelect(
|
|
13
|
+
'Intelligences',
|
|
14
|
+
{ where: { providerType: PROVIDER_TYPES.ITLEAN } },
|
|
15
|
+
['id']
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
const userId = generateId()
|
|
19
|
+
|
|
20
|
+
await queryInterface.bulkInsert('SystemUsers', [
|
|
21
|
+
{
|
|
22
|
+
id: userId,
|
|
23
|
+
name: process.env.SUPER_USER_NAME,
|
|
24
|
+
email: process.env.SUPER_USER_EMAIL,
|
|
25
|
+
password: encrypt(process.env.SUPER_USER_PASSWORD),
|
|
26
|
+
EnterpriseId,
|
|
27
|
+
createdAt: new Date(),
|
|
28
|
+
updatedAt: new Date(),
|
|
29
|
+
},
|
|
30
|
+
])
|
|
31
|
+
|
|
32
|
+
await queryInterface.bulkInsert('ItleanProviders', [
|
|
33
|
+
{
|
|
34
|
+
EnterpriseId,
|
|
35
|
+
IntelligenceId,
|
|
36
|
+
createdAt: new Date(),
|
|
37
|
+
updatedAt: new Date(),
|
|
38
|
+
},
|
|
39
|
+
])
|
|
40
|
+
},
|
|
41
|
+
down: async (queryInterface) => {
|
|
42
|
+
const { EnterpriseId, id } = await queryInterface.rawSelect(
|
|
43
|
+
'SystemUsers',
|
|
44
|
+
{ where: { email: process.env.SUPER_USER_EMAIL } },
|
|
45
|
+
['EnterpriseId', 'id']
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
await queryInterface.bulkDelete('ItleanProviders', { EnterpriseId }, {})
|
|
49
|
+
|
|
50
|
+
return queryInterface.bulkDelete('SystemUsers', { id }, {})
|
|
51
|
+
},
|
|
52
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
up: async (queryInterface, Sequelize) => {
|
|
3
|
+
const UserId = await queryInterface.rawSelect(
|
|
4
|
+
'SystemUsers',
|
|
5
|
+
{ where: { email: process.env.SUPER_USER_EMAIL } },
|
|
6
|
+
['id']
|
|
7
|
+
)
|
|
8
|
+
const profileId = await queryInterface.rawSelect(
|
|
9
|
+
'Profiles',
|
|
10
|
+
{ where: { name: 'Master' } },
|
|
11
|
+
['id']
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
return queryInterface.bulkInsert('SystemUsers_Profiles', [
|
|
15
|
+
{
|
|
16
|
+
SystemUserId: UserId,
|
|
17
|
+
ProfileId: profileId,
|
|
18
|
+
createdAt: new Date(),
|
|
19
|
+
updatedAt: new Date(),
|
|
20
|
+
},
|
|
21
|
+
])
|
|
22
|
+
},
|
|
23
|
+
down: async (queryInterface, Sequelize) => {
|
|
24
|
+
return queryInterface.bulkDelete('SystemUsers_Profiles', null, {})
|
|
25
|
+
},
|
|
26
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
up: async (queryInterface, Sequelize) => {
|
|
3
|
+
return queryInterface.bulkInsert('Languages', [
|
|
4
|
+
{
|
|
5
|
+
label: 'Português - Brasileiro',
|
|
6
|
+
value: 'pt-br',
|
|
7
|
+
createdAt: new Date(),
|
|
8
|
+
updatedAt: new Date(),
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
label: 'Inglês',
|
|
12
|
+
value: 'en-us',
|
|
13
|
+
createdAt: new Date(),
|
|
14
|
+
updatedAt: new Date(),
|
|
15
|
+
},
|
|
16
|
+
])
|
|
17
|
+
},
|
|
18
|
+
down: async (queryInterface, Sequelize) => {
|
|
19
|
+
return queryInterface.bulkDelete('Languages', null, {})
|
|
20
|
+
},
|
|
21
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
const { PROVIDER_TYPES } = require('../../presenters/constants')
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
up: async (queryInterface, Sequelize) => {
|
|
6
|
+
const EnterpriseId = await queryInterface.rawSelect(
|
|
7
|
+
'Enterprises',
|
|
8
|
+
{ where: { cnpj: process.env.ENTERPRISE_CNPJ } },
|
|
9
|
+
['id']
|
|
10
|
+
)
|
|
11
|
+
const IntelligenceId = await queryInterface.rawSelect(
|
|
12
|
+
'Intelligences',
|
|
13
|
+
{ where: { providerType: PROVIDER_TYPES.ITLEAN } },
|
|
14
|
+
['id']
|
|
15
|
+
)
|
|
16
|
+
await queryInterface.bulkInsert(
|
|
17
|
+
'ItleanProviders',
|
|
18
|
+
[
|
|
19
|
+
{
|
|
20
|
+
IntelligenceId,
|
|
21
|
+
EnterpriseId,
|
|
22
|
+
active: true,
|
|
23
|
+
createdAt: new Date(),
|
|
24
|
+
updatedAt: new Date(),
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
{}
|
|
28
|
+
)
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
down: async (queryInterface, Sequelize) => {
|
|
32
|
+
await queryInterface.bulkDelete('ItleanProviders', null, {})
|
|
33
|
+
},
|
|
34
|
+
}
|