@itleanchatbot/shared-models-js-postgres 2.2.0 → 2.3.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itleanchatbot/shared-models-js-postgres",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Shared Models JS Postgres",
5
5
  "main": "index.js",
6
6
  "license": "ISC",
@@ -1,7 +1,5 @@
1
1
  'use strict'
2
2
 
3
- const models = require('./../models')
4
-
5
3
  module.exports = {
6
4
  up: async (queryInterface, Sequelize) => {
7
5
  await queryInterface.createTable('Stopwords', {
@@ -1,4 +1,3 @@
1
- const models = require('./../models')
2
1
  const profiles = [
3
2
  {
4
3
  name: 'Master',
@@ -54,10 +53,11 @@ module.exports = {
54
53
  ['id']
55
54
  )
56
55
 
57
- const per = await queryInterface.select(
58
- models.Permissions,
59
- 'Permissions',
60
- { where: { permissionCode: prof.permissions } }
56
+ const per = await queryInterface.sequelize.query(
57
+ `SELECT id FROM "Permissions" where "permissionCode" IN (${prof.permissions.map(item => `'${item}'`).join(',')})`,
58
+ {
59
+ type: queryInterface.sequelize.QueryTypes.SELECT
60
+ }
61
61
  )
62
62
 
63
63
  prof_per = prof_per.concat(
@@ -74,7 +74,7 @@ module.exports = {
74
74
 
75
75
  return queryInterface.bulkInsert('Profiles_Permissions', prof_per)
76
76
  },
77
- down: async (queryInterface, Sequelize) => {
77
+ down: async (queryInterface) => {
78
78
  return queryInterface.bulkDelete('Profiles_Permissions', null, {})
79
79
  },
80
80
  }
@@ -1,5 +1,3 @@
1
- const models = require('../models')
2
-
3
1
  const configurations = {
4
2
  webchat: [
5
3
  {
@@ -112,10 +110,12 @@ const configurations = {
112
110
  }
113
111
 
114
112
  module.exports = {
115
- up: async (queryInterface, Sequelize) => {
116
- const channelTypes = await queryInterface.select(
117
- models.ChannelTypes,
118
- 'ChannelTypes'
113
+ up: async (queryInterface) => {
114
+ const channelTypes = await queryInterface.sequelize.query(
115
+ `SELECT * FROM "ChannelTypes"`,
116
+ {
117
+ type: queryInterface.sequelize.QueryTypes.SELECT
118
+ }
119
119
  )
120
120
 
121
121
  let channelConfigurations = []
@@ -140,7 +140,7 @@ module.exports = {
140
140
  channelConfigurations
141
141
  )
142
142
  },
143
- down: async (queryInterface, Sequelize) => {
143
+ down: async (queryInterface) => {
144
144
  return queryInterface.bulkDelete('ChannelConfigurations', null, {})
145
145
  },
146
146
  }
@@ -1,5 +1,3 @@
1
- const models = require('../models')
2
-
3
1
  const configurations = {
4
2
  whatsapp_gupshup: [
5
3
  {
@@ -11,10 +9,12 @@ const configurations = {
11
9
  }
12
10
 
13
11
  module.exports = {
14
- up: async (queryInterface, Sequelize) => {
15
- const channelTypes = await queryInterface.select(
16
- models.ChannelTypes,
17
- 'ChannelTypes'
12
+ up: async (queryInterface) => {
13
+ const channelTypes = await queryInterface.sequelize.query(
14
+ `SELECT * FROM "ChannelTypes"`,
15
+ {
16
+ type: queryInterface.sequelize.QueryTypes.SELECT
17
+ }
18
18
  )
19
19
 
20
20
  let channelConfigurations = []
@@ -39,7 +39,7 @@ module.exports = {
39
39
  channelConfigurations
40
40
  )
41
41
  },
42
- down: async (queryInterface, Sequelize) => {
42
+ down: async (queryInterface) => {
43
43
  return queryInterface.bulkDelete('ChannelConfigurations', null, {})
44
44
  },
45
45
  }
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
- up: async (queryInterface, Sequelize) => {
2
+ up: async (queryInterface) => {
3
3
  const [intention, entity, dialogNodes, apis] =
4
4
  await queryInterface.bulkInsert(
5
5
  'Permissions',
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
- up: async (queryInterface, Sequelize) => {
2
+ up: async (queryInterface) => {
3
3
  const [skill, botIterables] = await queryInterface.bulkInsert(
4
4
  'Permissions',
5
5
  [