@opengis/fastify-table 1.4.1 → 1.4.3
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,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
getOpt, getMeta, getTemplate, getData, pgClients, getToken,
|
|
3
3
|
} from '../../../../utils.js';
|
|
4
4
|
|
|
5
5
|
export default async function getTableData(req, reply) {
|
|
@@ -13,7 +13,11 @@ export default async function getTableData(req, reply) {
|
|
|
13
13
|
|
|
14
14
|
const { id } = params || {};
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const tokenData1 = await getOpt(params.table, user?.uid);
|
|
17
|
+
const tokenData2 = await getToken({
|
|
18
|
+
uid: user?.uid, token: params.table, json: true,
|
|
19
|
+
});
|
|
20
|
+
const tokenData = tokenData1 || tokenData2;
|
|
17
21
|
|
|
18
22
|
if (tokenData?.table) {
|
|
19
23
|
const loadTable = await getTemplate('table', tokenData.table);
|
|
@@ -28,6 +32,7 @@ export default async function getTableData(req, reply) {
|
|
|
28
32
|
const resp = await getData({
|
|
29
33
|
id, table: tokenData.table, pg, filter, state, limit, page, search, order, user, sql, contextQuery: tokenData.query,
|
|
30
34
|
}, reply);
|
|
35
|
+
if (resp?.addToken && tokenData.obj) { Object.assign(resp, { addToken: params.table }); }
|
|
31
36
|
return resp;
|
|
32
37
|
}
|
|
33
38
|
|