@opengis/fastify-table 1.1.145 → 1.1.146
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
|
@@ -28,7 +28,9 @@ export default async function suggest(req) {
|
|
|
28
28
|
if (table && !pg1.pk[body?.table || table]) {
|
|
29
29
|
return { status: 400, message: 'param name is invalid: 1' };
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
const tableMeta = await getMeta({ table: body?.table || table });
|
|
33
|
+
const columnExists = (body?.columns || tableMeta?.columns)?.find((col) => col?.name === column);
|
|
32
34
|
|
|
33
35
|
if (table && (!column || !columnExists)) {
|
|
34
36
|
return { status: 400, message: 'param name is invalid: 2' };
|
|
@@ -121,7 +123,7 @@ export default async function suggest(req) {
|
|
|
121
123
|
// return meta;
|
|
122
124
|
|
|
123
125
|
const val = query.val ? ` ${meta.pk}=any('{${query.val.replace(/'/g, "''")}}')` : '';
|
|
124
|
-
const where = [search, val, `${meta.pk} is not null`].filter((el) => el).join(' and ') || 'true';
|
|
126
|
+
const where = [search, val, meta.pk ? `${meta.pk} is not null` : null].filter((el) => el).join(' and ') || 'true';
|
|
125
127
|
|
|
126
128
|
const loadTable = await getTemplate('table', query.token);
|
|
127
129
|
const { columns = [] } = await getMeta({ table: loadTable?.table || query.token });
|