@opengis/fastify-table 2.0.95 → 2.0.96
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/dist/server/plugins/file/getExport.d.ts +1 -1
- package/dist/server/plugins/file/getExport.d.ts.map +1 -1
- package/dist/server/plugins/file/getExport.js +10 -3
- package/dist/server/routes/auth/controllers/2factor/providers/totp.d.ts.map +1 -1
- package/dist/server/routes/auth/controllers/2factor/providers/totp.js +5 -7
- package/dist/server/routes/auth/controllers/page/login2faTemplate.d.ts.map +1 -1
- package/dist/server/routes/auth/controllers/page/login2faTemplate.js +12 -0
- package/dist/server/routes/auth/controllers/page/loginEuSign.d.ts.map +1 -1
- package/dist/server/routes/auth/controllers/page/loginEuSign.js +14 -6
- package/dist/server/routes/auth/controllers/page/loginTemplate.d.ts.map +1 -1
- package/dist/server/routes/auth/controllers/page/loginTemplate.js +4 -0
- package/dist/server/routes/file/controllers/export.d.ts +2 -2
- package/dist/server/routes/file/controllers/export.d.ts.map +1 -1
- package/dist/server/routes/file/controllers/export.js +21 -12
- package/dist/server/routes/menu/controllers/getMenu.d.ts +2 -0
- package/dist/server/routes/menu/controllers/getMenu.d.ts.map +1 -1
- package/dist/server/routes/menu/controllers/getMenu.js +2 -0
- package/dist/server/routes/table/functions/getData.d.ts +3 -3
- package/dist/server/routes/table/functions/getData.d.ts.map +1 -1
- package/dist/server/routes/table/functions/getData.js +2 -1
- package/dist/server/templates/page/loginEuSign.html +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default function getExport({ pg, user, host,
|
|
1
|
+
export default function getExport({ pg, user, host, columns, cls, id, cols, search, format, table, tableSql, sourceName, filter, nocache, formatAnswer, sql, }: any, reply: any): Promise<any>;
|
|
2
2
|
//# sourceMappingURL=getExport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getExport.d.ts","sourceRoot":"","sources":["../../../../server/plugins/file/getExport.ts"],"names":[],"mappings":"AAEA,wBAA8B,SAAS,
|
|
1
|
+
{"version":3,"file":"getExport.d.ts","sourceRoot":"","sources":["../../../../server/plugins/file/getExport.ts"],"names":[],"mappings":"AAEA,wBAA8B,SAAS,CACrC,EACE,EAAE,EACF,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,GAAG,EACH,EAAE,EACF,IAAI,EACJ,MAAM,EACN,MAAM,EACN,KAAK,EACL,QAAQ,EACR,UAAU,EACV,MAAM,EACN,OAAO,EACP,YAAY,EACZ,GAAG,GACJ,EAAE,GAAG,EACN,KAAK,EAAE,GAAG,gBA4BX"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import routeExport from
|
|
2
|
-
export default async function getExport({ pg, user, host,
|
|
1
|
+
import routeExport from "../../routes/file/controllers/export.js";
|
|
2
|
+
export default async function getExport({ pg, user, host, columns, cls, id, cols, search, format, table, tableSql, sourceName, filter, nocache, formatAnswer, sql, }, reply) {
|
|
3
3
|
const query = {
|
|
4
4
|
id,
|
|
5
5
|
cols,
|
|
@@ -12,7 +12,14 @@ export default async function getExport({ pg, user, host, unittest, columns, cls
|
|
|
12
12
|
sql,
|
|
13
13
|
};
|
|
14
14
|
const result = await routeExport({
|
|
15
|
-
pg,
|
|
15
|
+
pg,
|
|
16
|
+
user,
|
|
17
|
+
host,
|
|
18
|
+
columns,
|
|
19
|
+
cls,
|
|
20
|
+
query,
|
|
21
|
+
tableSql,
|
|
22
|
+
sourceName,
|
|
16
23
|
}, reply);
|
|
17
24
|
return result;
|
|
18
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"totp.d.ts","sourceRoot":"","sources":["../../../../../../../server/routes/auth/controllers/2factor/providers/totp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAU1D,UAAU,OAAO;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,UAAU,CAAC;CAChB;AAED,UAAU,KAAK;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,UAAU,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAmBD,QAAA,MAAM,YAAY,GAAU,aAAa,OAAO,kBAK/C,CAAC;AAEF,QAAA,MAAM,YAAY,GAAU,aAAa,OAAO,kBAK/C,CAAC;AAEF,QAAA,MAAM,SAAS,GAAU,aAAa,OAAO;;;;EAc5C,CAAC;AAuBF,QAAA,MAAM,QAAQ,GAAU,aAAa,OAAO;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"totp.d.ts","sourceRoot":"","sources":["../../../../../../../server/routes/auth/controllers/2factor/providers/totp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAU1D,UAAU,OAAO;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,UAAU,CAAC;CAChB;AAED,UAAU,KAAK;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,UAAU,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAmBD,QAAA,MAAM,YAAY,GAAU,aAAa,OAAO,kBAK/C,CAAC;AAEF,QAAA,MAAM,YAAY,GAAU,aAAa,OAAO,kBAK/C,CAAC;AAEF,QAAA,MAAM,SAAS,GAAU,aAAa,OAAO;;;;EAc5C,CAAC;AAuBF,QAAA,MAAM,QAAQ,GAAU,aAAa,OAAO;;;;;;;;;;;;EAyD3C,CAAC;AAEF,QAAA,MAAM,MAAM,GAAU,0BAA0B,KAAK;;;EAiBpD,CAAC;AAKF,QAAA,MAAM,MAAM,GAAU,2BAA2B,KAAK,iBAqBrD,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;;AAE3E,wBAAoB"}
|
|
@@ -44,15 +44,13 @@ const generate = async ({ uid, pg }) => {
|
|
|
44
44
|
crypto.randomUUID(),
|
|
45
45
|
];
|
|
46
46
|
const userData = await pg
|
|
47
|
-
.query(`select social_auth_id as code, login, email from admin.users where uid=$1`, [uid])
|
|
47
|
+
.query(`select social_auth_id as code, coalesce(login,email) as login, email from admin.users where uid=$1`, [uid])
|
|
48
48
|
.then((el) => el.rows?.[0] || {});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
const { sufix } = config.auth?.["2fa"] || {};
|
|
50
|
+
if (sufix && !userData[sufix]) {
|
|
51
|
+
console.warn("2fa prefix not found at userData");
|
|
52
52
|
}
|
|
53
|
-
const otp = getOTP(
|
|
54
|
-
? userData[config.auth?.["2fa"]?.["sufix"]]
|
|
55
|
-
: userData.login || userData.code || uid, secret);
|
|
53
|
+
const otp = getOTP((sufix ? userData[sufix] : null) || userData.login || userData.code || uid, secret);
|
|
56
54
|
const qrCodeAsImageSource = await qrcode.toDataURL(otp);
|
|
57
55
|
// no entry in db
|
|
58
56
|
if (enabled === undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login2faTemplate.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/auth/controllers/page/login2faTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAiC5D,wBAA8B,aAAa,CACzC,GAAG,EAAE,eAAe,EACpB,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"login2faTemplate.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/auth/controllers/page/login2faTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAiC5D,wBAA8B,aAAa,CACzC,GAAG,EAAE,eAAe,EACpB,KAAK,EAAE,YAAY,kBA4EpB"}
|
|
@@ -48,6 +48,12 @@ export default async function loginTemplate(req, reply) {
|
|
|
48
48
|
const html = await handlebars.compile(bodyRecovery)({
|
|
49
49
|
recovery: true,
|
|
50
50
|
query: req.query,
|
|
51
|
+
// settings,
|
|
52
|
+
req,
|
|
53
|
+
protocol: req.protocol,
|
|
54
|
+
hostname: req.hostname,
|
|
55
|
+
port: process.env.PORT,
|
|
56
|
+
config,
|
|
51
57
|
});
|
|
52
58
|
return reply.headers(headers).send(html);
|
|
53
59
|
}
|
|
@@ -61,6 +67,12 @@ export default async function loginTemplate(req, reply) {
|
|
|
61
67
|
secretKey: qrCode ? secret || key : undefined,
|
|
62
68
|
enabled,
|
|
63
69
|
qrCode,
|
|
70
|
+
// settings,
|
|
71
|
+
req,
|
|
72
|
+
protocol: req.protocol,
|
|
73
|
+
hostname: req.hostname,
|
|
74
|
+
port: process.env.PORT,
|
|
75
|
+
config,
|
|
64
76
|
});
|
|
65
77
|
return reply.headers(headers).send(html);
|
|
66
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loginEuSign.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/auth/controllers/page/loginEuSign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"loginEuSign.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/auth/controllers/page/loginEuSign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAoBvD,wBAA8B,aAAa,CACzC,GAAG,EAAE,cAAc,EACnB,KAAK,EAAE,YAAY,kBAoBpB"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
|
+
import config from "../../../../../config.js";
|
|
5
|
+
import { handlebars } from "../../../../helpers/index.js";
|
|
4
6
|
import getTemplate from "../../../../plugins/table/funcs/getTemplate.js";
|
|
5
7
|
// relative default template filepath
|
|
6
8
|
const filename = fileURLToPath(import.meta.url);
|
|
@@ -11,10 +13,16 @@ const headers = {
|
|
|
11
13
|
"Accept-CH": "Viewport-Width, Width",
|
|
12
14
|
};
|
|
13
15
|
export default async function loginTemplate(req, reply) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const body1 = await getTemplate("page", "loginEuSign");
|
|
17
|
+
const body = !body1
|
|
18
|
+
? await readFile(path.join(dirname, "../../../../templates/page/loginEuSign.html"), "utf8")
|
|
19
|
+
: body1;
|
|
20
|
+
const html = await handlebars.compile(body)({
|
|
21
|
+
req,
|
|
22
|
+
protocol: req.protocol,
|
|
23
|
+
hostname: req.hostname,
|
|
24
|
+
port: process.env.PORT,
|
|
25
|
+
config,
|
|
26
|
+
});
|
|
27
|
+
return reply.headers(headers).send(html);
|
|
20
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loginTemplate.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/auth/controllers/page/loginTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,SAAS,CAAC;AAUvD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAY5D,wBAA8B,aAAa,CACzC,GAAG,EAAE,eAAe,EACpB,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"loginTemplate.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/auth/controllers/page/loginTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,SAAS,CAAC;AAUvD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAY5D,wBAA8B,aAAa,CACzC,GAAG,EAAE,eAAe,EACpB,KAAK,EAAE,YAAY,kBA4CpB"}
|
|
@@ -30,7 +30,9 @@ export default async function loginTemplate(req, reply) {
|
|
|
30
30
|
const html = await handlebars.compile(defaultBody)({
|
|
31
31
|
settings,
|
|
32
32
|
req,
|
|
33
|
+
protocol: req.protocol,
|
|
33
34
|
hostname: req.hostname,
|
|
35
|
+
port: process.env.PORT,
|
|
34
36
|
config,
|
|
35
37
|
});
|
|
36
38
|
return reply.headers(headers).send(html);
|
|
@@ -38,7 +40,9 @@ export default async function loginTemplate(req, reply) {
|
|
|
38
40
|
const html = await handlebars.compile(body)({
|
|
39
41
|
settings,
|
|
40
42
|
req,
|
|
43
|
+
protocol: req.protocol,
|
|
41
44
|
hostname: req.hostname,
|
|
45
|
+
port: process.env.PORT,
|
|
42
46
|
config,
|
|
43
47
|
});
|
|
44
48
|
return reply.headers(headers).send(html);
|
|
@@ -21,10 +21,10 @@ import type { ExtendedPG } from "../../../types/core.js";
|
|
|
21
21
|
* @returns {String|Object} message Повертає SQL запит або opt або рядки SQL запиту
|
|
22
22
|
* @returns {String} file Шлях до файла для скачування або відображення
|
|
23
23
|
*/
|
|
24
|
-
export default function exportTable({ pg,
|
|
24
|
+
export default function exportTable({ pg, headers, user, columns: columns1, cls, query, host, tableSql, sourceName, }: {
|
|
25
25
|
pg: ExtendedPG;
|
|
26
|
+
headers?: Record<string, any>;
|
|
26
27
|
user?: Record<string, any>;
|
|
27
|
-
unittest?: any;
|
|
28
28
|
columns?: string;
|
|
29
29
|
cls?: any;
|
|
30
30
|
query?: Record<string, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../../../../server/routes/file/controllers/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA0B5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAKzD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,wBAA8B,WAAW,CACvC,EACE,EAAqB,EACrB,IAAI,EACJ,
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../../../../server/routes/file/controllers/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA0B5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAKzD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,wBAA8B,WAAW,CACvC,EACE,EAAqB,EACrB,OAAO,EACP,IAAI,EACJ,OAAO,EAAE,QAAQ,EACjB,GAAG,EACH,KAAU,EACV,IAAkB,EAClB,QAAQ,EACR,UAAU,GACX,EAAE;IACD,EAAE,EAAE,UAAU,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,EACD,KAAK,EAAE,YAAY,gBA8WpB"}
|
|
@@ -13,7 +13,7 @@ import getTemplate from "../../../plugins/table/funcs/getTemplate.js";
|
|
|
13
13
|
import getMeta from "../../../plugins/pg/funcs/getMeta.js";
|
|
14
14
|
import pgClients from "../../../plugins/pg/pgClients.js";
|
|
15
15
|
import eventStream from "../../../plugins/util/funcs/eventStream.js";
|
|
16
|
-
import getData from "
|
|
16
|
+
import getData from "../../table/functions/getData.js";
|
|
17
17
|
import getFolder from "../../../plugins/crud/funcs/utils/getFolder.js";
|
|
18
18
|
import metaFormat from "../../../plugins/table/funcs/metaFormat/index.js";
|
|
19
19
|
import jsonToXls from "./utils/jsonToXls.js";
|
|
@@ -42,7 +42,7 @@ const rootDir = getFolder(config, "local");
|
|
|
42
42
|
* @returns {String|Object} message Повертає SQL запит або opt або рядки SQL запиту
|
|
43
43
|
* @returns {String} file Шлях до файла для скачування або відображення
|
|
44
44
|
*/
|
|
45
|
-
export default async function exportTable({ pg = pgClients.client,
|
|
45
|
+
export default async function exportTable({ pg = pgClients.client, headers, user, columns: columns1, cls, query = {}, host = "127.0.0.1", tableSql, sourceName, }, reply) {
|
|
46
46
|
const { id, cols, search, format = "json", table, filter = "empty", nocache, formatAnswer = "file", sql, stream, } = query;
|
|
47
47
|
if (!table && !tableSql) {
|
|
48
48
|
return reply.status(400).send("not enough params: table");
|
|
@@ -50,6 +50,7 @@ export default async function exportTable({ pg = pgClients.client, user, unittes
|
|
|
50
50
|
if (!["csv", "xlsx", "json", "geojson"].includes(format)) {
|
|
51
51
|
return reply.status(400).send("param format is invalid");
|
|
52
52
|
}
|
|
53
|
+
const slice = query.slice ? Math.min(+query.slice || 16, 16) : null;
|
|
53
54
|
const date = new Date();
|
|
54
55
|
const sufixName = `${filter}-${cols || "all"}-${search}-${query.limit || "unlimited"}-${id}`;
|
|
55
56
|
const sufixDate = [
|
|
@@ -101,19 +102,25 @@ export default async function exportTable({ pg = pgClients.client, user, unittes
|
|
|
101
102
|
.send("Ця форма не містить полів геометрії. Виберіть тип, який не потребує геометрії для вивантаження");
|
|
102
103
|
}
|
|
103
104
|
const options = {
|
|
104
|
-
id,
|
|
105
|
-
table,
|
|
106
105
|
pg,
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
params: {
|
|
107
|
+
id,
|
|
108
|
+
table,
|
|
109
|
+
},
|
|
110
|
+
query: {
|
|
111
|
+
filter,
|
|
112
|
+
search,
|
|
113
|
+
limit: slice,
|
|
114
|
+
sql,
|
|
115
|
+
},
|
|
116
|
+
headers,
|
|
109
117
|
user,
|
|
110
|
-
sql,
|
|
111
118
|
sufix: false,
|
|
112
119
|
};
|
|
113
120
|
// check total count, debug sql etc.
|
|
114
121
|
const result = tableSql || viewSql
|
|
115
122
|
? await pg
|
|
116
|
-
.query(`select count(*) as total, json_agg(row_to_json(q)) as rows from (${tableSql || viewSql})q where ${loadTable?.key && id
|
|
123
|
+
.query(`select count(*) as total, json_agg(row_to_json(q)) as rows from (select * from (${tableSql || viewSql})q ${slice ? `limit ${slice}` : ""} )q where ${loadTable?.key && id
|
|
117
124
|
? `${loadTable?.key}::text = '${id}'`
|
|
118
125
|
: "true"}`)
|
|
119
126
|
.then((el) => el.rows?.[0] || {})
|
|
@@ -123,7 +130,8 @@ export default async function exportTable({ pg = pgClients.client, user, unittes
|
|
|
123
130
|
if (!result?.rows?.length) {
|
|
124
131
|
return reply.status(200).send("Немає даних, які можна експортувати");
|
|
125
132
|
}
|
|
126
|
-
const { total, filtered = result.total || 0 } = result;
|
|
133
|
+
const { total, filtered: filtered1 = result.total || 0 } = result;
|
|
134
|
+
const filtered = slice ? result.count || slice : filtered1;
|
|
127
135
|
const limit = startStreamWithTotal > filtered
|
|
128
136
|
? filtered
|
|
129
137
|
: Math.min(query.limit || 1000, startStreamWithTotal) ||
|
|
@@ -157,9 +165,10 @@ export default async function exportTable({ pg = pgClients.client, user, unittes
|
|
|
157
165
|
.split(".")
|
|
158
166
|
.pop()}` // check for json data
|
|
159
167
|
: el.name);
|
|
160
|
-
const send = (+filtered > startStreamWithTotal || stream) &&
|
|
168
|
+
const send = ((!slice && +filtered > startStreamWithTotal) || stream) &&
|
|
169
|
+
process.env.NODE_ENV !== "test"
|
|
161
170
|
? eventStream(reply)
|
|
162
|
-
:
|
|
171
|
+
: process.env.NODE_ENV === "test"
|
|
163
172
|
? console.log
|
|
164
173
|
: () => { };
|
|
165
174
|
// export xlsx / csv / json
|
|
@@ -181,7 +190,7 @@ export default async function exportTable({ pg = pgClients.client, user, unittes
|
|
|
181
190
|
? await pg.query(`select * from (${tableSql || viewSql})q where ${loadTable?.key && id
|
|
182
191
|
? `${loadTable?.key}::text = '${id}'`
|
|
183
192
|
: "true"} limit ${options.limit} offset ${offset}`)
|
|
184
|
-
: await getData({ ...options, page }, reply, true);
|
|
193
|
+
: await getData({ ...options, query: { page, ...options.query } }, reply, true);
|
|
185
194
|
send(`seq: ${++seq}`);
|
|
186
195
|
send(`Обробка ${rows.length} об'єктів...`);
|
|
187
196
|
if (!rows.length) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMenu.d.ts","sourceRoot":"","sources":["../../../../../server/routes/menu/controllers/getMenu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AA4CzD,wBAA8B,SAAS,CACrC,EACE,IAAS,EACT,OAAO,EACP,EAAqB,GACtB,EAAE;IACD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,EAAE,EAAE,UAAU,CAAC;CAChB,EACD,KAAK,EAAE,YAAY,GAAG,IAAI
|
|
1
|
+
{"version":3,"file":"getMenu.d.ts","sourceRoot":"","sources":["../../../../../server/routes/menu/controllers/getMenu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AA4CzD,wBAA8B,SAAS,CACrC,EACE,IAAS,EACT,OAAO,EACP,EAAqB,GACtB,EAAE;IACD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,EAAE,EAAE,UAAU,CAAC;CAChB,EACD,KAAK,EAAE,YAAY,GAAG,IAAI;;;;;;;;;;;;;;GA0G3B"}
|
|
@@ -35,6 +35,8 @@ export default async function adminMenu({ user = {}, session, pg = pgClients.cli
|
|
|
35
35
|
return reply.status(403).send("access restricted");
|
|
36
36
|
}
|
|
37
37
|
const menus = isProduction && menuCache.length ? menuCache : await readMenu();
|
|
38
|
+
if (!pg)
|
|
39
|
+
return { menus };
|
|
38
40
|
const rows = pgClients.client?.pk?.["admin.properties"]
|
|
39
41
|
? await pgClients.client
|
|
40
42
|
.query(`select property_key as key,property_text as val from admin.properties where property_key~'^(${config.settingKeys || "site|map|admin"})'`)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FastifyReply } from "fastify";
|
|
2
2
|
import type { ExtendedPG } from "../../../types/core.js";
|
|
3
3
|
export default function dataAPI({ pg, params, table, id, headers, query, user, contextQuery, sufix, filterList, actions: actionsParam, columns: columnsParam, }: {
|
|
4
|
-
pg
|
|
4
|
+
pg?: ExtendedPG;
|
|
5
5
|
params?: {
|
|
6
6
|
id?: string;
|
|
7
7
|
query?: string;
|
|
@@ -9,9 +9,9 @@ export default function dataAPI({ pg, params, table, id, headers, query, user, c
|
|
|
9
9
|
};
|
|
10
10
|
table?: string;
|
|
11
11
|
id?: string;
|
|
12
|
-
headers
|
|
12
|
+
headers?: Record<string, any>;
|
|
13
13
|
query?: Record<string, any>;
|
|
14
|
-
user
|
|
14
|
+
user?: Record<string, any>;
|
|
15
15
|
contextQuery?: string;
|
|
16
16
|
sufix?: boolean;
|
|
17
17
|
filterList?: any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getData.d.ts","sourceRoot":"","sources":["../../../../../server/routes/table/functions/getData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AA4DzD,wBAA8B,OAAO,CACnC,EACE,EAAqB,EACrB,MAAM,EACN,KAAK,EACL,EAAE,EACF,OAAY,EACZ,KAAU,EACV,IAAS,EACT,YAAY,EACZ,KAAY,EACZ,UAAU,EACV,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,YAAY,GACtB,EAAE;IACD,EAAE,EAAE,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"getData.d.ts","sourceRoot":"","sources":["../../../../../server/routes/table/functions/getData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AA4DzD,wBAA8B,OAAO,CACnC,EACE,EAAqB,EACrB,MAAM,EACN,KAAK,EACL,EAAE,EACF,OAAY,EACZ,KAAU,EACV,IAAS,EACT,YAAY,EACZ,KAAY,EACZ,UAAU,EACV,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,YAAY,GACtB,EAAE;IACD,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB,MAAM,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,EACD,KAAK,EAAE,YAAY,EACnB,MAAM,CAAC,EAAE,GAAG,gBAi0Bb"}
|
|
@@ -416,7 +416,8 @@ export default async function dataAPI({ pg = pgClients.client, params, table, id
|
|
|
416
416
|
const statusClsData = statusCls ? await getSelect(statusCls, pg) : {};
|
|
417
417
|
statusClsData?.arr?.forEach((el) => status.push({
|
|
418
418
|
...el,
|
|
419
|
-
count: rows.filter((row) => el.id === row[statusColumn.name])
|
|
419
|
+
count: rows.filter((row) => el.id === row[statusColumn.name])
|
|
420
|
+
.length,
|
|
420
421
|
}));
|
|
421
422
|
}
|
|
422
423
|
const template = await getTemplate("card", templateName);
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
|
|
90
90
|
<div>
|
|
91
91
|
<a
|
|
92
|
-
href="https://id.softpro.ua/oauth/authorize?response_type=code&provider=google&client_id=photo-client-123&redirect_uri=https://
|
|
92
|
+
href="https://id.softpro.ua/oauth/authorize?response_type=code&provider=google&client_id=photo-client-123&redirect_uri={{coalesce protocol 'https'}}://{{req.raw.headers.host}}/auth/by_data&scope=profile email"
|
|
93
93
|
class="flex items-center justify-center mt-4 text-gray-600 transition-colors duration-300 transform border rounded-lg hover:bg-gray-50">
|
|
94
94
|
<div class="px-4 py-2">
|
|
95
95
|
<svg class="w-6 h-6" viewBox="0 0 40 40">
|