@websy/websy-designs 1.11.8 → 1.11.9

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.
@@ -149,7 +149,7 @@ class PGHelper {
149
149
  SELECT ${columns || '*'}
150
150
  FROM ${entity}
151
151
  `
152
- if ((process.env.TRANSLATE === true || process.env.TRANSLATE === 'true') && lang !== null) {
152
+ if ((process.env.TRANSLATE === true || process.env.TRANSLATE === 'true') && lang) {
153
153
  sql += `
154
154
  LEFT JOIN (
155
155
  SELECT entity_id, json_object_agg(field_name, text) as translation
@@ -159,7 +159,7 @@ class PGHelper {
159
159
  ) t2
160
160
  ON ${entity}.${(this.options.entityConfig[entity] && this.options.entityConfig[entity].idColumn) || 'id'} = t2.entity_id
161
161
  `
162
- }
162
+ }
163
163
  sql += `
164
164
  WHERE ${this.buildWhere(query.where, entity)}
165
165
  ${this.buildOrderBy(query)}
@@ -294,7 +294,8 @@ class PGHelper {
294
294
  return sql
295
295
  }
296
296
  buildWhere (input, entity) {
297
- if (typeof input === 'undefined') {
297
+ console.log('input is', input)
298
+ if (typeof input === 'undefined' || input.trim() === '') {
298
299
  return '1=1'
299
300
  }
300
301
  else {
@@ -337,8 +338,10 @@ class PGHelper {
337
338
  }
338
339
  }
339
340
  })
341
+ console.log('list is')
342
+ console.log(list)
340
343
  return `
341
- ${list.join(' AND ')}
344
+ ${list.length > 0 ? list.join(' AND ') : ''}
342
345
  `
343
346
  }
344
347
  }