@igea/oac_backend 1.0.74 → 1.0.75

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": "@igea/oac_backend",
3
- "version": "1.0.74",
3
+ "version": "1.0.75",
4
4
  "description": "Backend service for the OAC project",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -19,10 +19,13 @@ class Investigations {
19
19
  try{
20
20
  const sql = `SELECT
21
21
  id, uuid,
22
- array_to_string(
23
- regexp_split_to_array(?,'[^[:alnum:]_/:]+')
24
- ,','
25
- ) as label
22
+ array_to_string(ARRAY(
23
+ SELECT token
24
+ FROM unnest(
25
+ regexp_split_to_array(dataset, '[^[:alnum:]_/:]+')
26
+ ) AS token
27
+ WHERE token ILIKE ?
28
+ ), ',') AS label
26
29
  FROM investigations
27
30
  WHERE dataset_search @@ plainto_tsquery('simple', ?)
28
31
  OR dataset ILIKE ?
@@ -31,7 +34,7 @@ class Investigations {
31
34
  const tsQuery = `${text}:*`;
32
35
  const ilikeQuery = `%${text}%`;
33
36
  const result = await db.raw(sql,
34
- [txtQuery, tsQuery, ilikeQuery, limit, offset]
37
+ [ilikeQuery, tsQuery, ilikeQuery, limit, offset]
35
38
  );
36
39
  resolve(result.rows)
37
40
  }catch(e){
@@ -63,6 +66,7 @@ class Investigations {
63
66
  .first();
64
67
  let operation = existing ? 'UPDATE' : 'INSERT';
65
68
  if(existing){
69
+ delete item["id"]
66
70
  await db(table)
67
71
  .where({uuid: item.uuid})
68
72
  .update(item);