@opengis/fastify-table 1.2.98 → 1.3.0
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
|
@@ -125,7 +125,7 @@ export default async function getFilterSQL({
|
|
|
125
125
|
const customQuery = body?.filterCustom?.length && custom ? body.filterCustom?.find((el) => el.name === custom)?.sql : null;
|
|
126
126
|
const stateQuery = body?.filterState?.length && state ? body.filterState?.find((el) => el.name === state)?.sql : null;
|
|
127
127
|
|
|
128
|
-
const filterQuery = filters?.filter((el) => el.query)?.map((el) => `${el.query}
|
|
128
|
+
const filterQuery = filters?.filter((el) => el.query)?.map((el) => `${el.query}`).join(' and ');
|
|
129
129
|
const q = [body?.query, query, searchQuery, filterQuery, stateQuery, customQuery].filter((el) => el).join(' and ');
|
|
130
130
|
|
|
131
131
|
// table
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import applyHookSync from "../../../../hook/funcs/applyHookSync.js";
|
|
1
2
|
import getRangeQuery from "./getRangeQuery.js";
|
|
2
3
|
|
|
3
4
|
export default function formatValue({
|
|
@@ -9,6 +10,13 @@ export default function formatValue({
|
|
|
9
10
|
const filterType = filter.type?.toLowerCase() || 'text';
|
|
10
11
|
const fieldType = pg?.pgType?.[dataTypeID] || pg?.pgType?.[{ date: 1114 }[filterType] || 25];
|
|
11
12
|
|
|
13
|
+
const hookData = applyHookSync('onFormatValue', {
|
|
14
|
+
pg, pk, table, name, value, filterType, fieldType, filter, dataTypeID, uid, optimize,
|
|
15
|
+
});
|
|
16
|
+
if (hookData) {
|
|
17
|
+
return hookData?.query ? hookData : { op: '=', query: hookData };
|
|
18
|
+
}
|
|
19
|
+
|
|
12
20
|
if (!name
|
|
13
21
|
|| !value
|
|
14
22
|
|| (!dataTypeID && !extra && !sql && !options)
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import suggest from './controllers/suggest.js';
|
|
2
|
-
import data from './controllers/data.js';
|
|
3
|
-
|
|
4
|
-
import card from './controllers/card.js';
|
|
5
|
-
import search from './controllers/search.js';
|
|
6
|
-
import filter from './controllers/filter.js';
|
|
7
|
-
import form from './controllers/form.js';
|
|
8
|
-
|
|
9
|
-
import loadTemplatePath from '../../plugins/table/funcs/loadTemplatePath.js';
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
tableSchema, searchSchema, suggestSchema, formSchema, filterSchema,
|
|
13
|
-
} from './schema.js';
|
|
14
|
-
|
|
15
|
-
async function plugin(fastify, config = {}) {
|
|
16
|
-
const prefix = config.prefix || '/api';
|
|
17
|
-
const policy = ['public'];
|
|
18
|
-
fastify.get(`${prefix}/suggest/:data`, { config: { policy }, schema: suggestSchema }, suggest);
|
|
19
|
-
fastify.get(`${prefix}/data/:table/:id?`, { config: { policy: ['public', 'no-sql'] }, schema: tableSchema }, data); // vs.crm.data.api с node
|
|
20
|
-
|
|
21
|
-
fastify.get(`${prefix}/card/:table/:id`, { config: { policy }, schema: tableSchema }, card);
|
|
22
|
-
fastify.get(`${prefix}/search`, { config: { policy }, schema: searchSchema }, search);
|
|
23
|
-
|
|
24
|
-
fastify.get(`${prefix}/templates`, () => loadTemplatePath);
|
|
25
|
-
fastify.get(`${prefix}/filter/:table`, { config: { policy }, schema: filterSchema }, filter);
|
|
26
|
-
fastify.get(`${prefix}/form/:form`, { config: { policy }, schema: formSchema }, form);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default plugin;
|
|
1
|
+
import suggest from './controllers/suggest.js';
|
|
2
|
+
import data from './controllers/data.js';
|
|
3
|
+
|
|
4
|
+
import card from './controllers/card.js';
|
|
5
|
+
import search from './controllers/search.js';
|
|
6
|
+
import filter from './controllers/filter.js';
|
|
7
|
+
import form from './controllers/form.js';
|
|
8
|
+
|
|
9
|
+
import loadTemplatePath from '../../plugins/table/funcs/loadTemplatePath.js';
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
tableSchema, searchSchema, suggestSchema, formSchema, filterSchema,
|
|
13
|
+
} from './schema.js';
|
|
14
|
+
|
|
15
|
+
async function plugin(fastify, config = {}) {
|
|
16
|
+
const prefix = config.prefix || '/api';
|
|
17
|
+
const policy = ['public'];
|
|
18
|
+
fastify.get(`${prefix}/suggest/:data`, { config: { policy }, schema: suggestSchema }, suggest);
|
|
19
|
+
fastify.get(`${prefix}/data/:table/:id?`, { config: { policy: ['public', 'no-sql'] }, schema: tableSchema }, data); // vs.crm.data.api с node
|
|
20
|
+
|
|
21
|
+
fastify.get(`${prefix}/card/:table/:id`, { config: { policy }, schema: tableSchema }, card);
|
|
22
|
+
fastify.get(`${prefix}/search`, { config: { policy }, schema: searchSchema }, search);
|
|
23
|
+
|
|
24
|
+
fastify.get(`${prefix}/templates`, () => loadTemplatePath);
|
|
25
|
+
fastify.get(`${prefix}/filter/:table`, { config: { policy }, schema: filterSchema }, filter);
|
|
26
|
+
fastify.get(`${prefix}/form/:form`, { config: { policy }, schema: formSchema }, form);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default plugin;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import nextId from './controllers/next.id.js';
|
|
2
|
-
import statusMonitor from './controllers/status.monitor.js';
|
|
3
|
-
import userTokens from './controllers/user.tokens.js'
|
|
4
|
-
|
|
5
|
-
async function plugin(app, config = {}) {
|
|
6
|
-
const prefix = config.prefix || '/api';
|
|
7
|
-
app.get(`${prefix}/next-id`, {}, nextId);
|
|
8
|
-
app.get(`${prefix}/status-monitor`, {}, statusMonitor);
|
|
9
|
-
app.get(`${prefix}/user-tokens/:token`, { config: { policy: ['user'] } }, userTokens);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default plugin;
|
|
1
|
+
import nextId from './controllers/next.id.js';
|
|
2
|
+
import statusMonitor from './controllers/status.monitor.js';
|
|
3
|
+
import userTokens from './controllers/user.tokens.js'
|
|
4
|
+
|
|
5
|
+
async function plugin(app, config = {}) {
|
|
6
|
+
const prefix = config.prefix || '/api';
|
|
7
|
+
app.get(`${prefix}/next-id`, {}, nextId);
|
|
8
|
+
app.get(`${prefix}/status-monitor`, {}, statusMonitor);
|
|
9
|
+
app.get(`${prefix}/user-tokens/:token`, { config: { policy: ['user'] } }, userTokens);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default plugin;
|