@opengis/fastify-table 1.0.67 → 1.0.68
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/Changelog.md +2 -2
- package/package.json +1 -1
- package/table/controllers/suggest.js +4 -5
package/Changelog.md
CHANGED
package/package.json
CHANGED
|
@@ -4,20 +4,19 @@ import getPG from '../../pg/funcs/getPG.js';
|
|
|
4
4
|
const limit = 50;
|
|
5
5
|
const headers = { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET', 'Cache-Control': 'no-cache' };
|
|
6
6
|
|
|
7
|
-
export default async function suggest(req
|
|
7
|
+
export default async function suggest(req) {
|
|
8
8
|
const { params, query, pg: pg1 } = req;
|
|
9
9
|
|
|
10
10
|
const lang = query.lang || 'ua';
|
|
11
11
|
const time = Date.now();
|
|
12
12
|
const parent = query.parent || '';
|
|
13
13
|
|
|
14
|
-
res.headers(headers);
|
|
15
14
|
const selectName = query.sel || query.name || params.data;
|
|
16
|
-
if (!selectName) return { status: 400, message: 'name is required' };
|
|
15
|
+
if (!selectName) return { headers, status: 400, message: 'name is required' };
|
|
17
16
|
|
|
18
17
|
const meta = await getSelectMeta({ name: selectName });
|
|
19
|
-
const pg = meta.db ? getPG(
|
|
20
|
-
if (!meta) return { status: 404, message: 'Not found query select ' };
|
|
18
|
+
const pg = meta.db ? getPG(meta.db) : pg1;
|
|
19
|
+
if (!meta) return { headers, status: 404, message: 'Not found query select ' };
|
|
21
20
|
|
|
22
21
|
const { arr, searchQuery } = meta;
|
|
23
22
|
|