@itleanchatbot/shared-models-js-postgres 1.1.32 → 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 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itleanchatbot/shared-models-js-postgres",
3
- "version": "1.1.32",
3
+ "version": "1.1.34",
4
4
  "description": "Shared Models JS Postgres",
5
5
  "main": "index.js",
6
6
  "license": "ISC",
@@ -78,22 +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
- const string = JSON.stringify(value.map(item => {
84
- if(typeof string === 'object') {
85
- return JSON.stringify(item)
86
- } else {
87
- return JSON.stringify({ error: 'Parse error' })
88
- }
89
- }))
90
-
91
- this.setDataValue(field, string)
92
- } catch (error) {
93
- this.setDataValue(field, '')
94
- console.error(error)
95
- }
96
- },
97
81
  get(field) {
98
82
  try {
99
83
  let value = this.getDataValue(field)
@@ -114,7 +98,12 @@ const DialogNodesModel = (sequelize, Sequelize) => {
114
98
  }
115
99
  return value
116
100
  } catch (error) {
117
- return this.getDataValue(field)
101
+ let value = this.getDataValue(field)
102
+
103
+ if(typeof value === 'string') {
104
+ value = []
105
+ }
106
+ return value
118
107
  }
119
108
  },
120
109
  },