@opengis/gis 0.2.38 → 0.2.40
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.
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"meta": "title",
|
|
38
38
|
"name": "name",
|
|
39
39
|
"format": "slot",
|
|
40
|
-
"slot": "<p>{{data?.name}}</p><p class='text-xs text-gray-500'>{{data?.description}}</p>"
|
|
40
|
+
"slot": "<a :href=\"'/maps/'+ data?.id\" ><p>{{data?.name}}</p></a><p class='text-xs text-gray-500'>{{data?.description}}</p>"
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
"ua": "Ключові слова",
|
package/package.json
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
1
|
import { dataInsert, dataUpdate, pgClients } from "@opengis/fastify-table/utils.js";
|
|
2
|
+
|
|
2
3
|
export default async function addMap({
|
|
3
|
-
|
|
4
|
+
method, params = {}, body, pg = pgClients.client, user = {},
|
|
4
5
|
}, reply) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (!uid) {
|
|
8
|
-
return reply.status(401).send('unauthorized');
|
|
9
|
-
}
|
|
6
|
+
const { uid } = user;
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
8
|
+
if (!uid) {
|
|
9
|
+
return reply.status(401).send('unauthorized');
|
|
10
|
+
}
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const { rows = [] } = await dataInsert({
|
|
21
|
-
pg,
|
|
22
|
-
id: params.id,
|
|
23
|
-
table: 'gis.maps',
|
|
24
|
-
data: body,
|
|
25
|
-
uid,
|
|
26
|
-
});
|
|
27
|
-
return reply.status(200).send(rows[0]);
|
|
12
|
+
if (method === 'POST') {
|
|
13
|
+
if (!body?.name) {
|
|
14
|
+
return reply.status(400).send('not enough body params: name');
|
|
28
15
|
}
|
|
29
16
|
|
|
30
|
-
if (!
|
|
31
|
-
|
|
17
|
+
if (!body?.map_key) {
|
|
18
|
+
return reply.status(400).send('not enough body params: map_key');
|
|
32
19
|
}
|
|
33
20
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
21
|
+
const { rows = [] } = await dataInsert({
|
|
22
|
+
pg,
|
|
23
|
+
id: params.id,
|
|
24
|
+
table: 'gis.maps',
|
|
25
|
+
data: body,
|
|
26
|
+
uid,
|
|
40
27
|
});
|
|
41
|
-
return reply.status(200).send(
|
|
42
|
-
}
|
|
28
|
+
return reply.status(200).send(rows[0]);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!params.id) {
|
|
32
|
+
return reply.status(400).send('not enough params: id');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const row = await dataUpdate({
|
|
36
|
+
pg,
|
|
37
|
+
id: params.id,
|
|
38
|
+
table: 'gis.maps',
|
|
39
|
+
data: body,
|
|
40
|
+
uid,
|
|
41
|
+
});
|
|
42
|
+
return reply.status(200).send(row);
|
|
43
|
+
}
|
|
@@ -21,7 +21,7 @@ export default async function getMap({ params = {}, pg = pgClients.client }, rep
|
|
|
21
21
|
const mapList = getTemplates('map').map(el => el[0]);
|
|
22
22
|
|
|
23
23
|
const rows = pg.pk?.['gis.maps'] ? await pg.query(
|
|
24
|
-
`SELECT map_id as id,
|
|
24
|
+
`SELECT map_id as id, * FROM gis.maps where ${params.id ? '$1 in (map_id,map_key)' : '1=1'}`,
|
|
25
25
|
[params.id].filter(Boolean),
|
|
26
26
|
).then(el => el.rows || []) : [];
|
|
27
27
|
|