@itleanchatbot/shared-models-js-postgres 1.1.33 → 1.1.34

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/dialogNodes.js +6 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itleanchatbot/shared-models-js-postgres",
3
- "version": "1.1.33",
3
+ "version": "1.1.34",
4
4
  "description": "Shared Models JS Postgres",
5
5
  "main": "index.js",
6
6
  "license": "ISC",
@@ -78,26 +78,6 @@ const DialogNodesModel = (sequelize, Sequelize) => {
78
78
  type: Sequelize.TEXT,
79
79
  allowNull: false,
80
80
  defaultValue: '',
81
- set(value, field) {
82
- try {
83
- let string = JSON.stringify([])
84
-
85
- if(Array.isArray(value) && value.length) {
86
- string = JSON.stringify(value.map(item => {
87
- if(typeof string === 'object') {
88
- return JSON.stringify(item)
89
- } else {
90
- return JSON.stringify({ error: 'Parse error' })
91
- }
92
- }))
93
- }
94
-
95
- this.setDataValue(field, string)
96
- } catch (error) {
97
- this.setDataValue(field, '')
98
- console.error(error)
99
- }
100
- },
101
81
  get(field) {
102
82
  try {
103
83
  let value = this.getDataValue(field)
@@ -118,7 +98,12 @@ const DialogNodesModel = (sequelize, Sequelize) => {
118
98
  }
119
99
  return value
120
100
  } catch (error) {
121
- return this.getDataValue(field)
101
+ let value = this.getDataValue(field)
102
+
103
+ if(typeof value === 'string') {
104
+ value = []
105
+ }
106
+ return value
122
107
  }
123
108
  },
124
109
  },