@websy/websy-designs 1.9.9 → 1.9.10

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.
@@ -256,7 +256,12 @@ function ShopRoutes (dbHelper, engine, app) {
256
256
  for (let key in basket.items) {
257
257
  basket.items[key] = sanitizeItem(basket.items[key])
258
258
  }
259
- sql += `, items = '${JSON.stringify(basket.items)}' `
259
+ if (typeof basket.items === 'string') {
260
+ sql += `, items = '${basket.items}' `
261
+ }
262
+ else {
263
+ sql += `, items = '${JSON.stringify(basket.items)}' `
264
+ }
260
265
  }
261
266
  else {
262
267
  sql += `, meta = '${JSONSafeWrite(JSON.stringify(basket.meta))}' `
@@ -268,8 +273,12 @@ function ShopRoutes (dbHelper, engine, app) {
268
273
  }
269
274
  else {
270
275
  // insert
276
+ let itemString = basket.items
277
+ if (typeof itemString !== 'string') {
278
+ itemString = JSON.stringify(basket.items)
279
+ }
271
280
  const sql = `
272
- INSERT INTO ${req.params.basketCompare} (userid, items, meta) VALUES ('${req.session.user.id}', '${JSON.stringify(basket.items)}', '${JSONSafeWrite(JSON.stringify(basket.meta))}')
281
+ INSERT INTO ${req.params.basketCompare} (userid, items, meta) VALUES ('${req.session.user.id}', '${itemString}', '${JSONSafeWrite(JSON.stringify(basket.meta))}')
273
282
  `
274
283
  dbHelper.execute(sql).then(result => {
275
284
  resolve()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websy/websy-designs",
3
- "version": "1.9.9",
3
+ "version": "1.9.10",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"