@opengis/admin 0.3.64 → 0.3.66
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/{add-page-Daf1yymq.js → add-page-B4Ine_Pn.js} +1 -1
- package/dist/{admin-interface-DnE5Mnwe.js → admin-interface-DFf_t0db.js} +1 -1
- package/dist/{admin-view-CmSe43Q3.js → admin-view-eDKr7GB4.js} +1 -1
- package/dist/admin.js +1 -1
- package/dist/admin.umd.cjs +1 -1
- package/dist/{card-view-CN8LO5mm.js → card-view-uroZ1ej6.js} +1 -1
- package/dist/{edit-page-C7eUwU-5.js → edit-page-DARuYr_l.js} +1 -1
- package/dist/{import-file-DRzOvv7x.js → import-file-Dt2mnHAW.js} +135 -133
- package/dist/{profile-page-4waAht89.js → profile-page-5pEpnlCB.js} +1 -1
- package/package.json +4 -4
- package/server/routes/properties/controllers/admin.properties.get.js +6 -12
- package/server/routes/properties/controllers/admin.properties.post.js +17 -11
@@ -1,4 +1,4 @@
|
|
1
|
-
import { _ as n, e as m } from "./import-file-
|
1
|
+
import { _ as n, e as m } from "./import-file-Dt2mnHAW.js";
|
2
2
|
import { u as p } from "./user-B_2kh6ic.js";
|
3
3
|
import { resolveComponent as d, createElementBlock as f, openBlock as u, createElementVNode as o, createBlock as h, createCommentVNode as b } from "vue";
|
4
4
|
const x = {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@opengis/admin",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.66",
|
4
4
|
"description": "This project Softpro Admin",
|
5
5
|
"main": "dist/admin.js",
|
6
6
|
"type": "module",
|
@@ -46,9 +46,9 @@
|
|
46
46
|
"@fullcalendar/list": "^6.1.15",
|
47
47
|
"@fullcalendar/timegrid": "^6.1.15",
|
48
48
|
"@fullcalendar/vue3": "^6.1.15",
|
49
|
-
"@opengis/fastify-auth": "
|
50
|
-
"@opengis/fastify-file": "
|
51
|
-
"@opengis/fastify-table": "
|
49
|
+
"@opengis/fastify-auth": "1.0.80",
|
50
|
+
"@opengis/fastify-file": "1.0.66",
|
51
|
+
"@opengis/fastify-table": "1.3.25",
|
52
52
|
"@opengis/v3-core": "^0.3.126",
|
53
53
|
"@opengis/v3-filter": "^0.0.72",
|
54
54
|
"@tiptap/core": "^2.8.0",
|
@@ -6,26 +6,20 @@ import { pgClients, getTemplatePath, getTemplate } from '@opengis/fastify-table/
|
|
6
6
|
|
7
7
|
export default async function getSettingsApp({
|
8
8
|
pg = pgClients.client,
|
9
|
-
}) {
|
9
|
+
}, reply) {
|
10
10
|
const time = Date.now();
|
11
|
+
|
11
12
|
if (!pg.pk?.[table]) {
|
12
|
-
return
|
13
|
+
return reply.status(404).send('table not found');
|
13
14
|
}
|
14
15
|
|
15
|
-
|
16
|
-
const cache = await redis.get(keyCache);
|
17
|
-
|
18
|
-
if (cache && !config?.local) {
|
19
|
-
return JSON.parse(cache);
|
20
|
-
}*/
|
16
|
+
const { rows = [] } = await pg.query('select property_key as key, property_text, property_json from admin.properties');
|
21
17
|
|
22
|
-
const
|
23
|
-
const settings = rows.reduce((p, { key, val }) => { const [k1, k2] = key.split('.'); p[k1] = p[k1] || {}; p[k1][k2] = val; return p }, {});
|
24
|
-
const settings1 = rows.reduce((p, { key, val }) => ({ ...p, [key]: val }), {});
|
18
|
+
const settings = rows.reduce((acc, { key, property_text, property_json }) => ({ ...acc, [key]: property_text || property_json }), {});
|
25
19
|
|
26
20
|
const forms = await Promise.all(getTemplatePath('setting')
|
27
21
|
.map(async (el) => ({ name: el[0], body: await getTemplate('setting', el[0]) }))
|
28
22
|
);
|
29
23
|
|
30
|
-
return {
|
24
|
+
return reply.status(200).send({ time: Date.now() - time, forms, settings });
|
31
25
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
const table = 'admin.properties';
|
2
2
|
|
3
|
-
import { dataInsert } from '@opengis/fastify-table/utils.js';
|
3
|
+
import { dataInsert, pgClients } from '@opengis/fastify-table/utils.js';
|
4
4
|
|
5
5
|
function checkValueType(val) {
|
6
6
|
if (val) {
|
@@ -15,28 +15,34 @@ function checkValueType(val) {
|
|
15
15
|
}
|
16
16
|
|
17
17
|
export default async function postSettingsApp({
|
18
|
-
pg,
|
19
|
-
}) {
|
18
|
+
pg = pgClients.client, body = {}, user = {}, uid = user?.uid,
|
19
|
+
}, reply) {
|
20
20
|
if (!user?.user_type?.includes?.('admin')) {
|
21
|
-
return
|
21
|
+
return reply.status(403).send('access restricted');
|
22
22
|
}
|
23
23
|
const { key, val } = body;
|
24
|
+
|
24
25
|
if ((!key || !val) && !Object.keys(body).length) {
|
25
|
-
return
|
26
|
+
return reply.status(400).send('not enough body params');
|
26
27
|
}
|
27
28
|
|
28
29
|
if (!pg?.pk?.[table]) {
|
29
|
-
return
|
30
|
+
return reply.status(404).send('table not found');
|
30
31
|
}
|
32
|
+
|
31
33
|
const keys = Object.keys(body);
|
32
34
|
await pg.query(`delete from ${table} where property_key=any($1)`, [keys]);
|
33
35
|
|
34
|
-
await Promise.all(keys.map(async (el) => {
|
35
|
-
const columnType = table === 'admin.user_properties'
|
36
|
-
|
37
|
-
|
36
|
+
await Promise.all(keys.filter(el => body[el]).map(async (el) => {
|
37
|
+
const columnType = table === 'admin.user_properties'
|
38
|
+
? 'property_json'
|
39
|
+
: checkValueType(body[el]);
|
40
|
+
|
38
41
|
await dataInsert({
|
39
|
-
pg,
|
42
|
+
pg,
|
43
|
+
table,
|
44
|
+
data: { property_key: el, [columnType]: body[el] },
|
45
|
+
uid,
|
40
46
|
});
|
41
47
|
|
42
48
|
}));
|