@opengis/bi 1.0.18 → 1.0.19
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/README.md +110 -50
- package/config.js +12 -12
- package/dist/bi.js +1 -1
- package/dist/bi.umd.cjs +65 -73
- package/dist/{import-file-BdjSLXH1.js → import-file-BJjgK8Hl.js} +11020 -11026
- package/dist/{map-component-mixin-BPiLgT8e.js → map-component-mixin-BDeshFZi.js} +3803 -5455
- package/dist/style.css +1 -1
- package/dist/{vs-calendar-CQIKItUs.js → vs-calendar-D98bcwCO.js} +1 -1
- package/dist/{vs-funnel-bar-ChdzKfzS.js → vs-funnel-bar-Ps4AevXk.js} +1 -1
- package/dist/{vs-heatmap-l5NqfXmF.js → vs-heatmap-DQ4l7XOD.js} +1 -1
- package/dist/{vs-map-BYaGp0Cy.js → vs-map-C36n66Hj.js} +25 -24
- package/dist/vs-map-cluster-Bcjcul0f.js +76 -0
- package/dist/{vs-number-DN6VsgHi.js → vs-number-XzxJiWRu.js} +1 -1
- package/dist/{vs-text-7pOGGSJS.js → vs-text-DWhTWJlt.js} +2 -2
- package/package.json +94 -87
- package/plugin.js +14 -14
- package/server/migrations/bi.dataset.sql +32 -26
- package/server/migrations/bi.sql +93 -93
- package/server/plugins/docs.js +48 -48
- package/server/plugins/hook.js +89 -89
- package/server/plugins/vite.js +69 -69
- package/server/routes/dashboard/controllers/dashboard.delete.js +38 -38
- package/server/routes/dashboard/controllers/dashboard.js +118 -118
- package/server/routes/dashboard/controllers/dashboard.list.js +30 -30
- package/server/routes/dashboard/controllers/utils/yaml.js +11 -11
- package/server/routes/dashboard/index.mjs +25 -25
- package/server/routes/data/controllers/data.js +167 -167
- package/server/routes/data/controllers/util/chartSQL.js +42 -42
- package/server/routes/data/controllers/util/normalizeData.js +59 -59
- package/server/routes/data/index.mjs +29 -29
- package/server/routes/dataset/controllers/bi.dataset.add.js +86 -0
- package/server/routes/dataset/controllers/bi.dataset.data.add.js +49 -0
- package/server/routes/dataset/controllers/bi.dataset.data.del.js +54 -0
- package/server/routes/dataset/controllers/bi.dataset.data.edit.js +55 -0
- package/server/routes/dataset/controllers/bi.dataset.data.list.js +71 -0
- package/server/routes/dataset/controllers/bi.dataset.del.js +48 -0
- package/server/routes/dataset/controllers/bi.dataset.demo.add.js +2 -2
- package/server/routes/dataset/controllers/bi.dataset.edit.js +83 -0
- package/server/routes/dataset/controllers/bi.dataset.list.js +29 -0
- package/server/routes/dataset/controllers/bi.db.list.js +19 -0
- package/server/routes/dataset/controllers/util/create.table.js +2 -3
- package/server/routes/dataset/controllers/util/prepare.data.js +5 -5
- package/server/routes/dataset/index.mjs +75 -19
- package/server/routes/db/controllers/dbTablePreview.js +63 -63
- package/server/routes/db/controllers/dbTables.js +36 -36
- package/server/routes/db/index.mjs +17 -17
- package/server/routes/edit/controllers/dashboard.add.js +26 -26
- package/server/routes/edit/controllers/dashboard.edit.js +46 -46
- package/server/routes/edit/controllers/widget.add.js +75 -75
- package/server/routes/edit/controllers/widget.del.js +69 -69
- package/server/routes/edit/controllers/widget.edit.js +54 -54
- package/server/routes/edit/index.mjs +31 -31
- package/server/routes/map/controllers/cluster.js +109 -109
- package/server/routes/map/controllers/clusterVtile.js +166 -166
- package/server/routes/map/controllers/geojson.js +127 -127
- package/server/routes/map/controllers/map.js +60 -60
- package/server/routes/map/controllers/utils/downloadClusterData.js +42 -42
- package/server/routes/map/controllers/vtile.js +183 -183
- package/server/routes/map/index.mjs +25 -25
- package/server/utils/getWidget.js +85 -85
- package/utils.js +12 -12
- package/dist/vs-map-cluster-CeVIRHf6.js +0 -106
- package/server/routes/dataset/controllers/bi.dataset.import.js +0 -67
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { existsSync, readdirSync } from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
import { pgClients } from '@opengis/fastify-table/utils.js';
|
|
5
|
-
|
|
6
|
-
const cwd = process.cwd();
|
|
7
|
-
const dashboardDir = path.join(cwd, 'server/templates/dashboard');
|
|
8
|
-
|
|
9
|
-
export default async function data({ pg = pgClients.client, params = {} }) {
|
|
10
|
-
const { id } = params;
|
|
11
|
-
|
|
12
|
-
if (!id) {
|
|
13
|
-
return { message: 'not enough params: id', status: 400 };
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const dirContent = existsSync(dashboardDir) ? readdirSync(dashboardDir) : [];
|
|
17
|
-
|
|
18
|
-
if (dirContent.includes(id)) {
|
|
19
|
-
return { message: `access restricted: ${id}`, status: 403 };
|
|
20
|
-
}
|
|
21
|
-
try {
|
|
22
|
-
const { rowCount } = await pg.query(
|
|
23
|
-
`select * from bi.dashboard where $1 in (dashboard_id,name)`,
|
|
24
|
-
[id]
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
if (rowCount === 0) {
|
|
28
|
-
return { message: `not found ${id}`, status: 404 };
|
|
29
|
-
}
|
|
30
|
-
await pg.query(`delete from bi.widget where $1 in (dashboard_id)`, [id]);
|
|
31
|
-
await pg.query(`delete from bi.dashboard where $1 in (dashboard_id,name)`, [
|
|
32
|
-
id,
|
|
33
|
-
]);
|
|
34
|
-
return { message: 'successfully deleted', status: 200 };
|
|
35
|
-
} catch (err) {
|
|
36
|
-
return { error: err.toString(), status: 500 };
|
|
37
|
-
}
|
|
38
|
-
}
|
|
1
|
+
import { existsSync, readdirSync } from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
import { pgClients } from '@opengis/fastify-table/utils.js';
|
|
5
|
+
|
|
6
|
+
const cwd = process.cwd();
|
|
7
|
+
const dashboardDir = path.join(cwd, 'server/templates/dashboard');
|
|
8
|
+
|
|
9
|
+
export default async function data({ pg = pgClients.client, params = {} }) {
|
|
10
|
+
const { id } = params;
|
|
11
|
+
|
|
12
|
+
if (!id) {
|
|
13
|
+
return { message: 'not enough params: id', status: 400 };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const dirContent = existsSync(dashboardDir) ? readdirSync(dashboardDir) : [];
|
|
17
|
+
|
|
18
|
+
if (dirContent.includes(id)) {
|
|
19
|
+
return { message: `access restricted: ${id}`, status: 403 };
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const { rowCount } = await pg.query(
|
|
23
|
+
`select * from bi.dashboard where $1 in (dashboard_id,name)`,
|
|
24
|
+
[id]
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
if (rowCount === 0) {
|
|
28
|
+
return { message: `not found ${id}`, status: 404 };
|
|
29
|
+
}
|
|
30
|
+
await pg.query(`delete from bi.widget where $1 in (dashboard_id)`, [id]);
|
|
31
|
+
await pg.query(`delete from bi.dashboard where $1 in (dashboard_id,name)`, [
|
|
32
|
+
id,
|
|
33
|
+
]);
|
|
34
|
+
return { message: 'successfully deleted', status: 200 };
|
|
35
|
+
} catch (err) {
|
|
36
|
+
return { error: err.toString(), status: 500 };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
import yaml from 'js-yaml';
|
|
2
|
-
import {
|
|
3
|
-
pgClients,
|
|
4
|
-
getTemplatePath,
|
|
5
|
-
getTemplate,
|
|
6
|
-
getPGAsync,
|
|
7
|
-
} from '@opengis/fastify-table/utils.js';
|
|
8
|
-
|
|
9
|
-
export default async function dashboard({
|
|
10
|
-
pg = pgClients.client,
|
|
11
|
-
params = {},
|
|
12
|
-
}) {
|
|
13
|
-
const time = Date.now();
|
|
14
|
-
const { id } = params;
|
|
15
|
-
|
|
16
|
-
if (!id) {
|
|
17
|
-
return { message: 'not enough params: dashboard required', status: 400 };
|
|
18
|
-
}
|
|
19
|
-
const dashboards = await getTemplatePath('dashboard');
|
|
20
|
-
|
|
21
|
-
const fileDashboard = dashboards.find((el) => el[0] === id);
|
|
22
|
-
if (!fileDashboard) {
|
|
23
|
-
const sql = `select title, description, table_name, panels, grid, widgets, filters, style
|
|
24
|
-
from bi.dashboard where $1 in (dashboard_id, name)`;
|
|
25
|
-
|
|
26
|
-
const data = await pg.query(sql, [id]).then((res) => res.rows?.[0] || {});
|
|
27
|
-
data.type = 'bd';
|
|
28
|
-
const { table_name: table } = data;
|
|
29
|
-
|
|
30
|
-
if (!table) {
|
|
31
|
-
return { message: 'not enough params: table required', status: 400 };
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const { fields = [] } =
|
|
35
|
-
table && pg.pk?.[table]
|
|
36
|
-
? await pg.query(`select * from ${table} limit 0`)
|
|
37
|
-
: {};
|
|
38
|
-
|
|
39
|
-
const columns = table
|
|
40
|
-
? fields.map(({ name, dataTypeID }) => ({
|
|
41
|
-
name,
|
|
42
|
-
type: pg.pgType?.[dataTypeID],
|
|
43
|
-
}))
|
|
44
|
-
: [];
|
|
45
|
-
data?.widgets?.forEach?.(el => {
|
|
46
|
-
const { style, data = {}, type, title, x, metrics } = el;
|
|
47
|
-
el.yml = yaml.dump({ title, type, data: { x, metrics, ...data }, style, })
|
|
48
|
-
// el.yml = yaml.dump({ style, data, type, title });
|
|
49
|
-
})
|
|
50
|
-
return {
|
|
51
|
-
...data || {},
|
|
52
|
-
error:
|
|
53
|
-
table && !pg.pk?.[table] ? `table pkey not found: ${table}` : undefined,
|
|
54
|
-
table_name: table,
|
|
55
|
-
time: Date.now() - time,
|
|
56
|
-
columns,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const fileData = await getTemplate('dashboard', id);
|
|
61
|
-
const index = fileData.find((el) => el[0] === 'index.yml')[1];
|
|
62
|
-
|
|
63
|
-
if (!index) {
|
|
64
|
-
return { message: `not found ${id}`, status: 404 };
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const data = index;
|
|
68
|
-
data.type = 'file';
|
|
69
|
-
const { table } = data?.data || { table: data?.table_name };
|
|
70
|
-
|
|
71
|
-
const pg1 = data.db ? await getPGAsync(data.db) : pg;
|
|
72
|
-
|
|
73
|
-
const { fields = [] } = table
|
|
74
|
-
? await pg1.query(`select * from ${table} limit 0`)
|
|
75
|
-
: {};
|
|
76
|
-
|
|
77
|
-
const columns = fields.map(({ name, dataTypeID }) => ({
|
|
78
|
-
name,
|
|
79
|
-
type: pg.pgType?.[dataTypeID],
|
|
80
|
-
}));
|
|
81
|
-
|
|
82
|
-
const checks = index?.filters?.filter((el) => el?.id && columns.map((el) => el?.name).includes(el?.id) && el?.type === 'Check');
|
|
83
|
-
if (checks?.length) {
|
|
84
|
-
await Promise.all(checks.map(async (el) => {
|
|
85
|
-
if (el?.data) {
|
|
86
|
-
const options = await getTemplate('cls', el.data);
|
|
87
|
-
Object.assign(el, { options });
|
|
88
|
-
} else if (index?.table_name || index?.table) {
|
|
89
|
-
const { rows = [] } = await pg.query(`select "${el.id}" as id, count(*) from ${index?.table_name || index?.table} group by "${el.id}"`);
|
|
90
|
-
Object.assign(el, { options: rows });
|
|
91
|
-
}
|
|
92
|
-
}));
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// console.log(fileData)
|
|
96
|
-
const widgets = fileData
|
|
97
|
-
.filter((el) => el[0] !== 'index.yml')
|
|
98
|
-
.map((el) =>
|
|
99
|
-
el[1].data
|
|
100
|
-
? {
|
|
101
|
-
name: el[0].split('.')[0],
|
|
102
|
-
type: el[1].type,
|
|
103
|
-
title: el[1].title,
|
|
104
|
-
style: el[1].style,
|
|
105
|
-
data: el[1].data,
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
: { name: el[0].split('.')[0], title: el[1] }
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
return {
|
|
112
|
-
...data,
|
|
113
|
-
table_name: table,
|
|
114
|
-
time: Date.now() - time,
|
|
115
|
-
columns,
|
|
116
|
-
widgets,
|
|
117
|
-
};
|
|
118
|
-
}
|
|
1
|
+
import yaml from 'js-yaml';
|
|
2
|
+
import {
|
|
3
|
+
pgClients,
|
|
4
|
+
getTemplatePath,
|
|
5
|
+
getTemplate,
|
|
6
|
+
getPGAsync,
|
|
7
|
+
} from '@opengis/fastify-table/utils.js';
|
|
8
|
+
|
|
9
|
+
export default async function dashboard({
|
|
10
|
+
pg = pgClients.client,
|
|
11
|
+
params = {},
|
|
12
|
+
}) {
|
|
13
|
+
const time = Date.now();
|
|
14
|
+
const { id } = params;
|
|
15
|
+
|
|
16
|
+
if (!id) {
|
|
17
|
+
return { message: 'not enough params: dashboard required', status: 400 };
|
|
18
|
+
}
|
|
19
|
+
const dashboards = await getTemplatePath('dashboard');
|
|
20
|
+
|
|
21
|
+
const fileDashboard = dashboards.find((el) => el[0] === id);
|
|
22
|
+
if (!fileDashboard) {
|
|
23
|
+
const sql = `select title, description, table_name, panels, grid, widgets, filters, style
|
|
24
|
+
from bi.dashboard where $1 in (dashboard_id, name)`;
|
|
25
|
+
|
|
26
|
+
const data = await pg.query(sql, [id]).then((res) => res.rows?.[0] || {});
|
|
27
|
+
data.type = 'bd';
|
|
28
|
+
const { table_name: table } = data;
|
|
29
|
+
|
|
30
|
+
if (!table) {
|
|
31
|
+
return { message: 'not enough params: table required', status: 400 };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const { fields = [] } =
|
|
35
|
+
table && pg.pk?.[table]
|
|
36
|
+
? await pg.query(`select * from ${table} limit 0`)
|
|
37
|
+
: {};
|
|
38
|
+
|
|
39
|
+
const columns = table
|
|
40
|
+
? fields.map(({ name, dataTypeID }) => ({
|
|
41
|
+
name,
|
|
42
|
+
type: pg.pgType?.[dataTypeID],
|
|
43
|
+
}))
|
|
44
|
+
: [];
|
|
45
|
+
data?.widgets?.forEach?.(el => {
|
|
46
|
+
const { style, data = {}, type, title, x, metrics } = el;
|
|
47
|
+
el.yml = yaml.dump({ title, type, data: { x, metrics, ...data }, style, })
|
|
48
|
+
// el.yml = yaml.dump({ style, data, type, title });
|
|
49
|
+
})
|
|
50
|
+
return {
|
|
51
|
+
...data || {},
|
|
52
|
+
error:
|
|
53
|
+
table && !pg.pk?.[table] ? `table pkey not found: ${table}` : undefined,
|
|
54
|
+
table_name: table,
|
|
55
|
+
time: Date.now() - time,
|
|
56
|
+
columns,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const fileData = await getTemplate('dashboard', id);
|
|
61
|
+
const index = fileData.find((el) => el[0] === 'index.yml')[1];
|
|
62
|
+
|
|
63
|
+
if (!index) {
|
|
64
|
+
return { message: `not found ${id}`, status: 404 };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const data = index;
|
|
68
|
+
data.type = 'file';
|
|
69
|
+
const { table } = data?.data || { table: data?.table_name };
|
|
70
|
+
|
|
71
|
+
const pg1 = data.db ? await getPGAsync(data.db) : pg;
|
|
72
|
+
|
|
73
|
+
const { fields = [] } = table
|
|
74
|
+
? await pg1.query(`select * from ${table} limit 0`)
|
|
75
|
+
: {};
|
|
76
|
+
|
|
77
|
+
const columns = fields.map(({ name, dataTypeID }) => ({
|
|
78
|
+
name,
|
|
79
|
+
type: pg.pgType?.[dataTypeID],
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
const checks = index?.filters?.filter((el) => el?.id && columns.map((el) => el?.name).includes(el?.id) && el?.type === 'Check');
|
|
83
|
+
if (checks?.length) {
|
|
84
|
+
await Promise.all(checks.map(async (el) => {
|
|
85
|
+
if (el?.data) {
|
|
86
|
+
const options = await getTemplate('cls', el.data);
|
|
87
|
+
Object.assign(el, { options });
|
|
88
|
+
} else if (index?.table_name || index?.table) {
|
|
89
|
+
const { rows = [] } = await pg.query(`select "${el.id}" as id, count(*) from ${index?.table_name || index?.table} group by "${el.id}"`);
|
|
90
|
+
Object.assign(el, { options: rows });
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// console.log(fileData)
|
|
96
|
+
const widgets = fileData
|
|
97
|
+
.filter((el) => el[0] !== 'index.yml')
|
|
98
|
+
.map((el) =>
|
|
99
|
+
el[1].data
|
|
100
|
+
? {
|
|
101
|
+
name: el[0].split('.')[0],
|
|
102
|
+
type: el[1].type,
|
|
103
|
+
title: el[1].title,
|
|
104
|
+
style: el[1].style,
|
|
105
|
+
data: el[1].data,
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
: { name: el[0].split('.')[0], title: el[1] }
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
...data,
|
|
113
|
+
table_name: table,
|
|
114
|
+
time: Date.now() - time,
|
|
115
|
+
columns,
|
|
116
|
+
widgets,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { pgClients, getTemplate, getTemplatePath } from '@opengis/fastify-table/utils.js';
|
|
2
|
-
|
|
3
|
-
// import yaml from './utils/yaml.js';
|
|
4
|
-
// const cwd = process.cwd();
|
|
5
|
-
|
|
6
|
-
const q = `select dashboard_id as name, 'db' as type, title, description, table_name from bi.dashboard`;
|
|
7
|
-
|
|
8
|
-
export default async function data({ pg = pgClients.client }) {
|
|
9
|
-
const time = Date.now();
|
|
10
|
-
const data = await getTemplatePath('dashboard');
|
|
11
|
-
const dir = await Promise.all(
|
|
12
|
-
data.map(async ([filename]) => {
|
|
13
|
-
const data = await getTemplate('dashboard', filename);
|
|
14
|
-
const index = data.find((el) => el[0] === 'index.yml')[1];
|
|
15
|
-
const { table_name, description, title } = index || {};
|
|
16
|
-
|
|
17
|
-
return { name: filename, type: 'file', title, description, table_name };
|
|
18
|
-
})
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
const { rows = [] } = await pg.query(q);
|
|
22
|
-
|
|
23
|
-
const list = dir.concat(rows);
|
|
24
|
-
|
|
25
|
-
const res = {
|
|
26
|
-
time: Date.now() - time,
|
|
27
|
-
rows: list,
|
|
28
|
-
};
|
|
29
|
-
return res;
|
|
30
|
-
}
|
|
1
|
+
import { pgClients, getTemplate, getTemplatePath } from '@opengis/fastify-table/utils.js';
|
|
2
|
+
|
|
3
|
+
// import yaml from './utils/yaml.js';
|
|
4
|
+
// const cwd = process.cwd();
|
|
5
|
+
|
|
6
|
+
const q = `select dashboard_id as name, 'db' as type, title, description, table_name from bi.dashboard`;
|
|
7
|
+
|
|
8
|
+
export default async function data({ pg = pgClients.client }) {
|
|
9
|
+
const time = Date.now();
|
|
10
|
+
const data = await getTemplatePath('dashboard');
|
|
11
|
+
const dir = await Promise.all(
|
|
12
|
+
data.map(async ([filename]) => {
|
|
13
|
+
const data = await getTemplate('dashboard', filename);
|
|
14
|
+
const index = data.find((el) => el[0] === 'index.yml')[1];
|
|
15
|
+
const { table_name, description, title } = index || {};
|
|
16
|
+
|
|
17
|
+
return { name: filename, type: 'file', title, description, table_name };
|
|
18
|
+
})
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const { rows = [] } = await pg.query(q);
|
|
22
|
+
|
|
23
|
+
const list = dir.concat(rows);
|
|
24
|
+
|
|
25
|
+
const res = {
|
|
26
|
+
time: Date.now() - time,
|
|
27
|
+
rows: list,
|
|
28
|
+
};
|
|
29
|
+
return res;
|
|
30
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import yaml from 'js-yaml';
|
|
2
|
-
|
|
3
|
-
yaml.loadSafe = (yml) => {
|
|
4
|
-
try {
|
|
5
|
-
return yaml.load(yml);
|
|
6
|
-
} catch (err) {
|
|
7
|
-
return { error: err.toString() };
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default yaml;
|
|
1
|
+
import yaml from 'js-yaml';
|
|
2
|
+
|
|
3
|
+
yaml.loadSafe = (yml) => {
|
|
4
|
+
try {
|
|
5
|
+
return yaml.load(yml);
|
|
6
|
+
} catch (err) {
|
|
7
|
+
return { error: err.toString() };
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default yaml;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import config from '../../../config.js';
|
|
2
|
-
|
|
3
|
-
import dashboard from './controllers/dashboard.js';
|
|
4
|
-
import dashboardList from './controllers/dashboard.list.js';
|
|
5
|
-
import dashboardDelete from './controllers/dashboard.delete.js';
|
|
6
|
-
const biSchema = {
|
|
7
|
-
querystring: {
|
|
8
|
-
widget: { type: 'string', pattern: '^([\\d\\w]+)$' },
|
|
9
|
-
dashboard: { type: 'string', pattern: '^([\\d\\w]+)$' },
|
|
10
|
-
list: { type: 'string', pattern: '^([\\d])$' },
|
|
11
|
-
sql: { type: 'string', pattern: '^([\\d])$' },
|
|
12
|
-
},
|
|
13
|
-
params: {
|
|
14
|
-
id: { type: 'string', pattern: '^([\\d\\w]+)$' },
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default async function route(fastify) {
|
|
19
|
-
fastify.get(`/bi-dashboard/:id`, { schema: biSchema }, dashboard);
|
|
20
|
-
fastify.get(`/bi-dashboard`, dashboardList);
|
|
21
|
-
fastify.delete(`/bi-dashboard/:id`, dashboardDelete);
|
|
22
|
-
fastify.get(`/bi-test`, () => {
|
|
23
|
-
return { test: '2' };
|
|
24
|
-
});
|
|
25
|
-
}
|
|
1
|
+
import config from '../../../config.js';
|
|
2
|
+
|
|
3
|
+
import dashboard from './controllers/dashboard.js';
|
|
4
|
+
import dashboardList from './controllers/dashboard.list.js';
|
|
5
|
+
import dashboardDelete from './controllers/dashboard.delete.js';
|
|
6
|
+
const biSchema = {
|
|
7
|
+
querystring: {
|
|
8
|
+
widget: { type: 'string', pattern: '^([\\d\\w]+)$' },
|
|
9
|
+
dashboard: { type: 'string', pattern: '^([\\d\\w]+)$' },
|
|
10
|
+
list: { type: 'string', pattern: '^([\\d])$' },
|
|
11
|
+
sql: { type: 'string', pattern: '^([\\d])$' },
|
|
12
|
+
},
|
|
13
|
+
params: {
|
|
14
|
+
id: { type: 'string', pattern: '^([\\d\\w]+)$' },
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default async function route(fastify) {
|
|
19
|
+
fastify.get(`/bi-dashboard/:id`, { schema: biSchema }, dashboard);
|
|
20
|
+
fastify.get(`/bi-dashboard`, dashboardList);
|
|
21
|
+
fastify.delete(`/bi-dashboard/:id`, dashboardDelete);
|
|
22
|
+
fastify.get(`/bi-test`, () => {
|
|
23
|
+
return { test: '2' };
|
|
24
|
+
});
|
|
25
|
+
}
|