@opengis/admin 0.2.106 → 0.2.108

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": "@opengis/admin",
3
- "version": "0.2.106",
3
+ "version": "0.2.108",
4
4
  "description": "This project Softpro Admin",
5
5
  "main": "dist/admin.js",
6
6
  "type": "module",
@@ -7,7 +7,7 @@ export default async function tableFilter(req) {
7
7
  const { uid } = user || {};
8
8
 
9
9
  if (!params.name) {
10
- return { message: 'not enouggh params: name', status: 400 };
10
+ return { message: 'not enough params: name', status: 400 };
11
11
  }
12
12
 
13
13
  const loadTable = await getTemplate('table', params.name);
@@ -65,6 +65,11 @@ export default async function tableFilter(req) {
65
65
  Object.assign(el, { options });
66
66
  }));
67
67
 
68
+ const sqlList = loadTable?.sql
69
+ ?.filter((el) => !el.disabled && el?.sql?.replace)
70
+ ?.map((el, i) => ` left join lateral (${el.filter ? el.sql.replace(/limit 1/ig, '') : el.sql}) as ${el.name || `t${i + 1}`} on 1=1 `)
71
+ ?.join(' ') || '';
72
+
68
73
  // percentile_cont - alternative
69
74
  await Promise.all(filters.filter((el) => el.name && el.type === 'Range').map(async (el) => {
70
75
  const data = await pg.queryCache(`select array[
@@ -73,7 +78,7 @@ export default async function tableFilter(req) {
73
78
  percentile_disc(0.5) within group (order by ${el.name}),
74
79
  percentile_disc(0.75) within group (order by ${el.name}),
75
80
  max(${el.name})
76
- ] as range from ${loadTable.table} where ${loadTable.query || '1=1'}`, { table: loadTable.table }).then(el => el.rows?.[0]?.range);
81
+ ] as range from ${loadTable.table} ${sqlList ? ` t ${sqlList}` : ''} where ${loadTable.query || '1=1'}`, { table: loadTable.table }).then(el => el.rows?.[0]?.range);
77
82
  Object.assign(el, { data });
78
83
  }));
79
84