@opengis/fastify-table 2.0.25 → 2.0.26
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.
|
@@ -38,7 +38,7 @@ export default async function getFilterSQL({ table, filter, pg = pgClients.clien
|
|
|
38
38
|
const { fields: fieldsModel = [] } = body?.table && pg.pk?.[body.table]
|
|
39
39
|
? await pg.query(`select * from ${body.table} limit 0`)
|
|
40
40
|
: {};
|
|
41
|
-
const { q: extraSqlColumns, extraColumns = [] } = pg.pk?.[extraDataTable] && pg.pk?.[body.table || table]
|
|
41
|
+
const { q: extraSqlColumns, extraColumns = [] } = extraDataTable && pg.pk?.[extraDataTable] && pg.pk?.[body.table || table]
|
|
42
42
|
? getExtraQuery(fieldsModel, loadTemplate?.schema, extraDataTable, pg.pk[body.table || table])
|
|
43
43
|
: {};
|
|
44
44
|
// console.log('extra getFilterSQL', extraDataTable, pg.pk?.[extraDataTable]);
|
|
@@ -26,7 +26,7 @@ export default async function getSelectVal({ pg = pgClients.client, name, values
|
|
|
26
26
|
// select id column name
|
|
27
27
|
if (!selectIds[name]) {
|
|
28
28
|
selectIds[name] = await pg
|
|
29
|
-
.
|
|
29
|
+
.query(`select * from (${cls.sql})q limit 0`)
|
|
30
30
|
.then((el) => el.fields?.[0]?.name)
|
|
31
31
|
.catch((err) => console.error("getSelectVal error: 1", name, cls.sql, err.toString()));
|
|
32
32
|
}
|
|
@@ -39,7 +39,7 @@ export default async function suggest(req) {
|
|
|
39
39
|
const [table, column] = params.data?.includes(":")
|
|
40
40
|
? params.data.split(":")
|
|
41
41
|
: [query.token, query.column];
|
|
42
|
-
const selectName = query.sel ||
|
|
42
|
+
const selectName = query.sel || params.data;
|
|
43
43
|
if (!selectName)
|
|
44
44
|
return { status: 400, message: "name is required" };
|
|
45
45
|
const { body: hookBody } = table || query.token
|