@opengis/gis 0.2.168 → 0.2.170
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/{CardIcon-DzERD2T8.js → CardIcon-DXaESte6.js} +1 -1
- package/dist/{EntityTablePage-DAVJRQLe.js → EntityTablePage-BwyMNhrm.js} +1 -1
- package/dist/{ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-B-6axJUY.js → ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-DrHke0pk.js} +1 -1
- package/dist/{HeaderActions.vue_vue_type_script_setup_true_lang-D1iwSeRN.js → HeaderActions.vue_vue_type_script_setup_true_lang-9Rm8Dhc4.js} +1 -1
- package/dist/{MapSettings-wVix8wMh.js → MapSettings-E1aNltts.js} +1 -1
- package/dist/{RastersTablePage-u3oN_h_n.js → RastersTablePage-CJblEi8a.js} +1 -1
- package/dist/{cartocss-BIveBlgY.js → cartocss-Dv2QILZ2.js} +5 -5
- package/dist/{import-utils-DkKPU_Nd.js → import-utils-CL-V2wSj.js} +1 -1
- package/dist/{index-C3bl1qBS.js → index-Bi60lcRm.js} +4768 -4718
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +31 -31
- package/dist/{raster-CfTJZx5p.js → raster-nn-sOUb9.js} +3 -3
- package/dist/{register-dV5ipRhb.js → register-CjHXBGr5.js} +3 -3
- package/dist/{service-DWC5gq3L.js → service-l3Csdnxm.js} +8 -7
- package/dist/{vs-datatable-Cd2Gp4jo.js → vs-datatable-CJlE3-mz.js} +3 -2
- package/module/test/map/addr.json +303 -0
- package/module/test/map/{addr.yml → addr1.yml} +3 -1
- package/module/test/select/address.str_id.sql +3 -0
- package/package.json +10 -10
- package/plugin.js +21 -12
- package/server/plugins/mapnik/funcs/checkRasterFile.js +1 -3
- package/server/routes/cartocss/cartocss.route.js +31 -0
- package/server/routes/cartocss/cartocss.route.test.js +79 -0
- package/server/routes/cartocss/cartocss.schema.js +73 -0
- package/server/routes/{gis/cartocss → cartocss/functions}/add.cartocss.js +8 -11
- package/server/routes/{gis/cartocss → cartocss/functions}/get.cartocss.js +11 -13
- package/server/routes/gis/functions/checkXML.js +107 -0
- package/server/routes/gis/functions/dashboard.js +24 -0
- package/server/routes/gis/gis.route.js +26 -0
- package/server/routes/gis/gis.route.test.js +34 -0
- package/server/routes/gis/gis.schema.js +1 -0
- package/server/routes/map/{controllers → functions}/clearTiles.js +9 -8
- package/server/routes/map/{controllers → functions}/geojson.js +43 -43
- package/server/routes/map/{controllers → functions}/gis.convert.js +15 -23
- package/server/routes/map/{controllers → functions}/gis.icon.js +23 -10
- package/server/routes/map/{controllers → functions}/jsonData.js +72 -71
- package/server/routes/map/{controllers → functions}/layerList.js +17 -17
- package/server/routes/map/{controllers → functions}/map.js +8 -9
- package/server/routes/map/{controllers → functions}/mapCatalog.js +7 -7
- package/server/routes/map/functions/mapCatalogAttribute.js +54 -0
- package/server/routes/map/{controllers → functions}/mapFeatures.js +22 -18
- package/server/routes/map/{controllers → functions}/mapFormat.js +25 -28
- package/server/routes/map/{controllers → functions}/mapTiles.js +39 -30
- package/server/routes/map/{controllers → functions}/maps.js +3 -3
- package/server/routes/map/{controllers → functions}/marker_icon.js +1 -1
- package/server/routes/map/{controllers → functions}/parseGeoFile.js +10 -11
- package/server/routes/map/{controllers → functions}/pointHeight.js +3 -7
- package/server/routes/map/{controllers → functions}/vtile.js +5 -3
- package/server/routes/map/{vtile1.js → functions/vtile1.js} +39 -33
- package/server/routes/map/map.route.js +280 -0
- package/server/routes/map/map.route.test.js +503 -0
- package/server/routes/map/map.schema.js +356 -0
- package/server/routes/mapnik/{controllers → functions}/clearTiles.js +26 -29
- package/server/routes/mapnik/{controllers → functions}/createXml.js +17 -20
- package/server/routes/mapnik/{controllers → functions}/createXmlMulti.js +11 -15
- package/server/routes/mapnik/{controllers → functions}/fileSearch.js +6 -9
- package/server/routes/mapnik/functions/fileStat.js +28 -0
- package/server/routes/mapnik/{controllers → functions}/pretile.js +29 -35
- package/server/routes/mapnik/{controllers → functions}/rasterInfo.js +19 -10
- package/server/routes/mapnik/{controllers → functions}/readDir.js +4 -4
- package/server/routes/mapnik/functions/rtile.js +164 -0
- package/server/routes/mapnik/{controllers → functions}/uploadRaster.js +19 -24
- package/server/routes/mapnik/functions/uploadXML.js +27 -0
- package/server/routes/mapnik/mapnik.route.js +102 -0
- package/server/routes/mapnik/mapnik.route.test.js +371 -0
- package/server/routes/mapnik/mapnik.schema.mjs +190 -0
- package/server/routes/mapnik.prefixless/functions/mapnikLogger.js +31 -0
- package/server/routes/{mapnik/controllers → mapnik.prefixless/functions}/mapnikStat.js +7 -5
- package/server/routes/mapnik.prefixless/mapnik.prefixless.route.js +20 -0
- package/server/routes/mapnik.prefixless/mapnik.prefixless.route.test.js +91 -0
- package/server/routes/mapnik.prefixless/mapnik.prefixless.schema.mjs +27 -0
- package/server/routes/maps/functions/add.map.js +42 -0
- package/server/routes/{map/maps → maps/functions}/del.map.js +6 -7
- package/server/routes/{map/maps → maps/functions}/get.map.js +12 -11
- package/server/routes/maps/maps.route.js +58 -0
- package/server/routes/maps/maps.route.test.js +231 -0
- package/server/routes/maps/maps.schema.js +10 -0
- package/server/routes/metadata/functions/editMetadata.js +35 -0
- package/server/routes/metadata/functions/metadataXML.js +19 -0
- package/server/routes/metadata/metadata.route.js +26 -0
- package/server/routes/metadata/metadata.route.test.js +47 -0
- package/server/routes/metadata/metadata.schema.js +53 -0
- package/server/routes/{gis/ogc → ogc/functions}/map.info.point.js +22 -29
- package/server/routes/ogc/ogc.route.js +21 -0
- package/server/routes/ogc/ogc.route.test.js +54 -0
- package/server/routes/ogc/ogc.schema.js +16 -0
- package/server/routes/permissions/functions/catalog.permissions.edit.js +20 -0
- package/server/routes/permissions/functions/catalog.permissions.js +13 -0
- package/server/routes/permissions/{controllers → functions}/gis.catalog.js +10 -10
- package/server/routes/permissions/permissions.route.js +35 -0
- package/server/routes/permissions/permissions.route.test.js +35 -0
- package/server/routes/permissions/permissions.schema.js +44 -0
- package/server/routes/registers/functions/add.registry.js +37 -0
- package/server/routes/{gis/registers/funcs → registers/functions}/classifiers.js +2 -2
- package/server/routes/{gis/registers → registers/functions}/del.registry.js +5 -5
- package/server/routes/{gis/registers/funcs → registers/functions}/get.info.js +9 -5
- package/server/routes/{gis/registers → registers/functions}/gis.export.js +27 -21
- package/server/routes/{gis/registers → registers/functions}/gis.registry.js +22 -15
- package/server/routes/{gis/registers → registers/functions}/gis.registry.list.js +12 -10
- package/server/routes/{gis/registers/funcs → registers/functions}/handleRegistryRequest.js +12 -11
- package/server/routes/registers/registers.route.js +80 -0
- package/server/routes/registers/registers.route.test.js +145 -0
- package/server/routes/registers/registers.schema.js +246 -0
- package/server/routes/{gis/services → services/functions}/add.service.js +14 -16
- package/server/routes/services/functions/create.route.js +93 -0
- package/server/routes/{gis/services → services/functions}/del.service.js +5 -5
- package/server/routes/{gis/services → services/functions}/get.service.users.js +15 -13
- package/server/routes/services/functions/get.services.col.js +34 -0
- package/server/routes/{gis/services → services/functions}/get.services.js +21 -16
- package/server/routes/services/services.route.js +76 -0
- package/server/routes/services/services.route.test.js +168 -0
- package/server/routes/services/services.schema.js +278 -0
- package/server/routes/widgets/functions/add.widget.js +39 -0
- package/server/routes/widgets/functions/del.widget.js +18 -0
- package/server/routes/{map/widgets → widgets/functions}/get.widget.js +12 -11
- package/server/routes/widgets/widgets.route.js +61 -0
- package/server/routes/widgets/widgets.route.test.js +144 -0
- package/server/routes/widgets/widgets.schema.js +25 -0
- package/module/cls.json +0 -7
- package/module/gis/card/gis.metadata.table/main_info.hbs +0 -21
- package/module/gis/card/gis.metadata.table/metadata_info.hbs +0 -28
- package/module/gis/card/gis.metadata.table/other.hbs +0 -26
- package/module/gis/card/gis.rasters.table/main_info.hbs +0 -27
- package/module/gis/card/gis.registers.table/cls.hbs +0 -36
- package/module/gis/card/gis.registers.table/columns.hbs +0 -89
- package/module/gis/card/gis.registers.table/filters.hbs +0 -80
- package/module/gis/card/gis.registers.table/main_info.hbs +0 -35
- package/module/gis/card/gis.registers.table/source.hbs +0 -45
- package/module/gis/card/gis.services.table/attributes.hbs +0 -91
- package/module/gis/card/gis.services.table/filters.hbs +0 -83
- package/module/gis/card/gis.services.table/main_info.hbs +0 -27
- package/module/gis/card/gis.services.table/source.hbs +0 -26
- package/module/test/cls/bp_build_type.json +0 -37
- package/module/test/cls/doc_status.json +0 -32
- package/module/test/cls/ts.temp_status.json +0 -18
- package/module/test/cls/ts.temp_structure.ts_class.json +0 -50
- package/module/test/cls/ts.temp_type.json +0 -10
- package/module/test/layer/bp.json +0 -60
- package/module/test/layer/bp1.yml +0 -33
- package/module/test/layer/individual.yml +0 -54
- package/module/test/layer/ts.linking_passport.yml +0 -56
- package/module/test/layer/ts.temp_structure.yml +0 -51
- package/module/test/map/bp_myo.json +0 -44
- package/module/test/map/bpf.json +0 -44
- package/module/test/map/main.json +0 -39
- package/module/test/map/mbd.json +0 -92
- package/module/test/map/ts.json +0 -53
- package/module/test/select/address_id.json +0 -3
- package/module/test/select/address_id.sql +0 -8
- package/module/test/select/core.user_uid.sql +0 -1
- package/module/test/table/data_address.street.table.json +0 -70
- package/module/test/table/data_bp_myo.bp.table.json +0 -123
- package/server/routes/gis/checkXML.js +0 -117
- package/server/routes/gis/dashboard.js +0 -29
- package/server/routes/gis/index.mjs +0 -92
- package/server/routes/gis/metadata/editMetadata.js +0 -34
- package/server/routes/gis/metadata/metadataXML.js +0 -13
- package/server/routes/gis/registers/add.registry.js +0 -35
- package/server/routes/gis/registers/insert.columns.js +0 -107
- package/server/routes/gis/registers/insert.filters.js +0 -110
- package/server/routes/gis/services/create.route.js +0 -96
- package/server/routes/gis/services/get.services.col.js +0 -33
- package/server/routes/map/controllers/mapCatalogAttribute.js +0 -56
- package/server/routes/map/index.mjs +0 -259
- package/server/routes/map/maps/add.map.js +0 -43
- package/server/routes/map/widgets/add.widget.js +0 -39
- package/server/routes/map/widgets/del.widget.js +0 -23
- package/server/routes/mapnik/controllers/fileStat.js +0 -28
- package/server/routes/mapnik/controllers/mapnikLogger.js +0 -29
- package/server/routes/mapnik/controllers/rtile.js +0 -167
- package/server/routes/mapnik/index.js +0 -40
- package/server/routes/permissions/controllers/catalog.permissions.edit.js +0 -22
- package/server/routes/permissions/controllers/catalog.permissions.js +0 -8
- package/server/routes/permissions/index.mjs +0 -18
- /package/server/routes/map/{controllers/pin → pin}/circle1.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/circle2.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/none.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/pin.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/pin1.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/pin2.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/pin3.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/pin4.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/pin5.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/pin6.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/pin7.svg +0 -0
- /package/server/routes/permissions/{controllers/utils → functions}/get.permissions.js +0 -0
- /package/server/routes/{gis/registers/funcs → registers/functions}/columns.js +0 -0
- /package/server/routes/{gis/registers/funcs → registers/functions}/content.type.js +0 -0
- /package/server/routes/{gis/registers → registers/functions}/map.registry.js +0 -0
- /package/server/routes/{gis/services → services/functions}/get.layer.geom.js +0 -0
- /package/server/routes/{gis/services → services/functions}/legend.auto.js +0 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import {
|
|
2
|
+
describe, test, expect, beforeAll,
|
|
3
|
+
} from 'vitest';
|
|
4
|
+
|
|
5
|
+
import { build, injectWithHeaders } from '../../../test/helper.js';
|
|
6
|
+
|
|
7
|
+
const user = { uid: '2', type: 'admin' };
|
|
8
|
+
|
|
9
|
+
beforeAll(async () => {
|
|
10
|
+
await build();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('GET /logger-gis/stat (restrict unauthorized)', async () => {
|
|
14
|
+
const res = await injectWithHeaders({
|
|
15
|
+
method: 'GET',
|
|
16
|
+
url: '/logger-gis/stat',
|
|
17
|
+
|
|
18
|
+
});
|
|
19
|
+
expect(res.statusCode).toBe(403);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('GET /logger-gis/stat (restrict non-admin)', async () => {
|
|
23
|
+
const res = await injectWithHeaders({
|
|
24
|
+
method: 'GET',
|
|
25
|
+
url: '/logger-gis/stat',
|
|
26
|
+
headers: { uid: user.uid, user_type: 'regular' }
|
|
27
|
+
|
|
28
|
+
});
|
|
29
|
+
expect(res.statusCode).toBe(403);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('GET /logger-gis/stat', async () => {
|
|
33
|
+
const res = await injectWithHeaders({
|
|
34
|
+
method: 'GET',
|
|
35
|
+
url: '/logger-gis/stat',
|
|
36
|
+
headers: { uid: user.uid, user_type: user.type }
|
|
37
|
+
|
|
38
|
+
});
|
|
39
|
+
expect(res.statusCode).toBe(200);
|
|
40
|
+
|
|
41
|
+
const body = res.json();
|
|
42
|
+
|
|
43
|
+
expect(body).toHaveProperty('timestamp');
|
|
44
|
+
expect(body).toHaveProperty('global');
|
|
45
|
+
expect(body).toHaveProperty('per_map_id');
|
|
46
|
+
expect(typeof body.global).toBe('object');
|
|
47
|
+
expect(typeof body.per_map_id).toBe('object');
|
|
48
|
+
expect(body.global).toHaveProperty('total_use_count');
|
|
49
|
+
expect(body.global).toHaveProperty('ready_1');
|
|
50
|
+
expect(body.global).toHaveProperty('total_maps');
|
|
51
|
+
expect(body.global).toHaveProperty('ready_0');
|
|
52
|
+
expect(body.global).toHaveProperty('max_in_use');
|
|
53
|
+
expect(body.global).toHaveProperty('current_in_use');
|
|
54
|
+
expect(body.global).toHaveProperty('avg_use_time_sec');
|
|
55
|
+
|
|
56
|
+
const mapKey = Object.keys(body.per_map_id)[0];
|
|
57
|
+
if (mapKey) {
|
|
58
|
+
expect(body.per_map_id[mapKey]).toHaveProperty('use_count');
|
|
59
|
+
expect(body.per_map_id[mapKey]).toHaveProperty('ready_1');
|
|
60
|
+
expect(body.per_map_id[mapKey]).toHaveProperty('total');
|
|
61
|
+
expect(body.per_map_id[mapKey]).toHaveProperty('ready_0');
|
|
62
|
+
expect(body.per_map_id[mapKey]).toHaveProperty('avg_use_time_sec');
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
describe('GET /gis-logger', () => {
|
|
67
|
+
test('returns log root directories', async () => {
|
|
68
|
+
const res = await injectWithHeaders({
|
|
69
|
+
method: 'GET',
|
|
70
|
+
url: '/logger-gis/',
|
|
71
|
+
headers: { uid: user.uid, user_type: user.type }
|
|
72
|
+
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
expect(res.statusCode).toBe(200);
|
|
76
|
+
expect(res.headers['content-type']).toBe('text/html; charset=UTF-8');
|
|
77
|
+
expect(res.body).toMatch('<a href=');
|
|
78
|
+
});
|
|
79
|
+
test('returns error log directories', async () => {
|
|
80
|
+
const res = await injectWithHeaders({
|
|
81
|
+
method: 'GET',
|
|
82
|
+
url: '/logger-gis/error',
|
|
83
|
+
headers: { uid: user.uid, user_type: user.type }
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
});
|
|
87
|
+
expect(res.statusCode).toBe(200);
|
|
88
|
+
expect(res.headers['content-type']).toBe('text/html; charset=UTF-8');
|
|
89
|
+
expect(res.body).toMatch('<a href=');
|
|
90
|
+
});
|
|
91
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// values hardcoded into mapnik
|
|
2
|
+
const periodSchema = {
|
|
3
|
+
type: 'string', enum: ['1w', '1d', '1h', '5m', '1m']
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export const mapnikStatSchema = {
|
|
8
|
+
querystring: {
|
|
9
|
+
type: "object",
|
|
10
|
+
additionalProperties: false,
|
|
11
|
+
properties: {
|
|
12
|
+
period: periodSchema,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const mapnikLoggerSchema = {
|
|
18
|
+
querystring: {
|
|
19
|
+
type: "object",
|
|
20
|
+
additionalProperties: false,
|
|
21
|
+
properties: {
|
|
22
|
+
debug: { type: "number", minimum: 1, maximum: 10 },
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default null;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BadRequestError, UnauthorizedError } from "@opengis/fastify-table/errors.js";
|
|
2
|
+
import { dataInsert, dataUpdate, pgClients } from "@opengis/fastify-table/utils.js";
|
|
3
|
+
|
|
4
|
+
export default async function addMap({
|
|
5
|
+
method, id, body, uid,
|
|
6
|
+
}, pg = pgClients.client) {
|
|
7
|
+
if (!uid) {
|
|
8
|
+
throw UnauthorizedError('unauthorized');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (method === 'POST') {
|
|
12
|
+
if (!body?.name) {
|
|
13
|
+
throw BadRequestError('not enough body params: name');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (!body?.map_key) {
|
|
17
|
+
throw BadRequestError('not enough body params: map_key');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const { rows = [] } = await dataInsert({
|
|
21
|
+
pg,
|
|
22
|
+
id,
|
|
23
|
+
table: 'gis.maps',
|
|
24
|
+
data: body,
|
|
25
|
+
uid,
|
|
26
|
+
});
|
|
27
|
+
return rows[0];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (!id) {
|
|
31
|
+
throw BadRequestError('not enough params: id');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const row = await dataUpdate({
|
|
35
|
+
pg,
|
|
36
|
+
id,
|
|
37
|
+
table: 'gis.maps',
|
|
38
|
+
data: body,
|
|
39
|
+
uid,
|
|
40
|
+
});
|
|
41
|
+
return row;
|
|
42
|
+
}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
+
import { UnauthorizedError } from "@opengis/fastify-table/errors.js";
|
|
1
2
|
import { dataDelete, pgClients } from "@opengis/fastify-table/utils.js";
|
|
2
3
|
|
|
3
4
|
export default async function delMap({
|
|
4
|
-
|
|
5
|
-
},
|
|
6
|
-
const { uid } = user;
|
|
7
|
-
|
|
5
|
+
id, uid,
|
|
6
|
+
}, pg = pgClients.client) {
|
|
8
7
|
if (!uid) {
|
|
9
|
-
|
|
8
|
+
throw UnauthorizedError('unauthorized');
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
const row = await dataDelete({
|
|
13
12
|
pg,
|
|
14
|
-
id
|
|
13
|
+
id,
|
|
15
14
|
table: 'gis.maps',
|
|
16
15
|
uid,
|
|
17
16
|
});
|
|
18
|
-
return
|
|
17
|
+
return row;
|
|
19
18
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NotFoundError } from '@opengis/fastify-table/errors.js';
|
|
1
2
|
import {
|
|
2
3
|
getMeta, getTemplate, pgClients, getTemplates, yml2json,
|
|
3
4
|
} from '@opengis/fastify-table/utils.js';
|
|
@@ -14,7 +15,7 @@ const columnType = {
|
|
|
14
15
|
'timestamp with time zone': 'date',
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
export default async function getMap({
|
|
18
|
+
export default async function getMap({ id }, pg = pgClients.client) {
|
|
18
19
|
const { columns = [] } = await getMeta({ pg, table }) || {};
|
|
19
20
|
|
|
20
21
|
const fields = columns.map(({ name, dataTypeID, title }) => ({
|
|
@@ -26,12 +27,12 @@ export default async function getMap({ params = {}, pg = pgClients.client }, rep
|
|
|
26
27
|
const mapList = getTemplates('map').map(el => el[0]);
|
|
27
28
|
|
|
28
29
|
const rows = pg.pk?.['gis.maps'] ? await pg.query(
|
|
29
|
-
`SELECT map_id as id, * FROM gis.maps where ${
|
|
30
|
-
[
|
|
30
|
+
`SELECT map_id as id, * FROM gis.maps where ${id ? '$1 in (map_id,map_key)' : '1=1'}`,
|
|
31
|
+
[id].filter(Boolean),
|
|
31
32
|
).then(el => el.rows || []) : [];
|
|
32
33
|
|
|
33
|
-
if (
|
|
34
|
-
|
|
34
|
+
if (id && !mapList?.includes(id) && !rows[0]) {
|
|
35
|
+
throw NotFoundError('map not found');
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
const totals = pg.queryCache ? await pg.queryCache('select json_object_agg(oid::regclass, reltuples) from pg_class')
|
|
@@ -45,9 +46,9 @@ export default async function getMap({ params = {}, pg = pgClients.client }, rep
|
|
|
45
46
|
maps.unshift({ id: 'main', slug: 'main', name: 'Основна карта' });
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
if (
|
|
49
|
+
if (id) {
|
|
49
50
|
const map = rows[0] || {};
|
|
50
|
-
const loadTemplate = await getTemplate('map',
|
|
51
|
+
const loadTemplate = await getTemplate('map', id) || await getTemplate('map', map.map_key);
|
|
51
52
|
const obj = loadTemplate || map;
|
|
52
53
|
|
|
53
54
|
const rawIds = [
|
|
@@ -107,12 +108,12 @@ export default async function getMap({ params = {}, pg = pgClients.client }, rep
|
|
|
107
108
|
layers = layersResults.filter(Boolean);
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
return
|
|
111
|
+
return { maps, ...obj, layers };
|
|
111
112
|
}
|
|
112
113
|
|
|
113
|
-
if (
|
|
114
|
-
|
|
114
|
+
if (id && !rows.length) {
|
|
115
|
+
throw NotFoundError('map not found');
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
return
|
|
118
|
+
return id ? { ...rows[0], fields } : { rows, fields };
|
|
118
119
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import getMap from './functions/get.map.js';
|
|
2
|
+
import addMap from './functions/add.map.js';
|
|
3
|
+
import delMap from './functions/del.map.js';
|
|
4
|
+
|
|
5
|
+
import { schemaInfo } from './maps.schema.js';
|
|
6
|
+
|
|
7
|
+
const publicParams = {
|
|
8
|
+
config: { policy: 'L0' },
|
|
9
|
+
schema: schemaInfo,
|
|
10
|
+
package: 'gis',
|
|
11
|
+
}; // * L0 === public
|
|
12
|
+
const privilegedParams = {
|
|
13
|
+
config: { policy: 'L1', role: 'admin' },
|
|
14
|
+
schema: schemaInfo,
|
|
15
|
+
package: 'gis',
|
|
16
|
+
}; // ? just auth or admin
|
|
17
|
+
|
|
18
|
+
export default function (app) {
|
|
19
|
+
if (!app.hasRoute({ method: 'GET', url: '/gis-map/:id?' })) {
|
|
20
|
+
app.get('/gis-map/:id?', publicParams, async ({ params, pg }) => {
|
|
21
|
+
const result = await getMap({
|
|
22
|
+
id: params.id,
|
|
23
|
+
}, pg);
|
|
24
|
+
return result;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (!app.hasRoute({ method: 'POST', url: '/gis-map/:id?' })) {
|
|
28
|
+
app.post('/gis-map/:id?', privilegedParams, async ({ method, body, params, user, pg }) => {
|
|
29
|
+
const result = await addMap({
|
|
30
|
+
method,
|
|
31
|
+
id: params.id,
|
|
32
|
+
body,
|
|
33
|
+
uid: user?.uid,
|
|
34
|
+
}, pg);
|
|
35
|
+
return result;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (!app.hasRoute({ method: 'PUT', url: '/gis-map/:id' })) {
|
|
39
|
+
app.put('/gis-map/:id', privilegedParams, async ({ method, body, params, user, pg }) => {
|
|
40
|
+
const result = await addMap({
|
|
41
|
+
method,
|
|
42
|
+
id: params.id,
|
|
43
|
+
body,
|
|
44
|
+
uid: user?.uid,
|
|
45
|
+
}, pg);
|
|
46
|
+
return result;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (!app.hasRoute({ method: 'DELETE', url: '/gis-map/:id' })) {
|
|
50
|
+
app.delete('/gis-map/:id', privilegedParams, async ({ params, user, pg }) => {
|
|
51
|
+
const result = await delMap({
|
|
52
|
+
id: params.id,
|
|
53
|
+
uid: user?.uid,
|
|
54
|
+
}, pg);
|
|
55
|
+
return result;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/* eslint-disable indent */
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
describe, test, expect, beforeAll, afterAll,
|
|
6
|
+
} from 'vitest';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
getPGAsync, dataInsert,
|
|
10
|
+
} from '@opengis/fastify-table/utils.js';
|
|
11
|
+
|
|
12
|
+
import { build, injectWithHeaders } from '../../../test/helper.js';
|
|
13
|
+
|
|
14
|
+
const user = { uid: '1', user_type: 'admin' };
|
|
15
|
+
const testKey = 'unittest';
|
|
16
|
+
|
|
17
|
+
let pg;
|
|
18
|
+
|
|
19
|
+
const obj = {};
|
|
20
|
+
|
|
21
|
+
describe('maps api test', () => {
|
|
22
|
+
beforeAll(async () => {
|
|
23
|
+
await build();
|
|
24
|
+
pg = await getPGAsync();
|
|
25
|
+
// ensure not exists in case previous test fails / timeouts
|
|
26
|
+
const { rowCount } = await pg.query('delete from gis.maps where array[$1] && keywords', [testKey]);
|
|
27
|
+
console.log('clean up before: ', rowCount);
|
|
28
|
+
await pg.query(
|
|
29
|
+
'insert into gis.maps (map_id, name, keywords, created_by, center) values($1, $1, array[$1], $2, $3) on conflict (map_id) do nothing returning *',
|
|
30
|
+
[testKey, user.uid, [30, 50]],
|
|
31
|
+
);
|
|
32
|
+
console.log('insert before success');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
afterAll(async () => {
|
|
36
|
+
const { rowCount: maps } = await pg.query('delete from gis.maps where array[$1] && keywords', [testKey]);
|
|
37
|
+
console.log('clean up maps after: ', maps);
|
|
38
|
+
const { rowCount: widgets } = await pg.query('delete from gis.widgets where map_id in ($1,$2)', [testKey, name]);
|
|
39
|
+
console.log('clean up widgets after: ', widgets);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('GET /gis-map', async () => {
|
|
43
|
+
const res = await injectWithHeaders({
|
|
44
|
+
method: 'GET',
|
|
45
|
+
url: '/api/gis-map',
|
|
46
|
+
headers: { uid: user.uid, user_type: user.user_type }
|
|
47
|
+
});
|
|
48
|
+
expect(res.statusCode).toBe(200);
|
|
49
|
+
expect(res.headers['content-type']).toBe('application/json; charset=utf-8');
|
|
50
|
+
const json = res.json();
|
|
51
|
+
Object.assign(obj, { 'GET/gis-map': json });
|
|
52
|
+
expect(json).toHaveProperty('rows');
|
|
53
|
+
expect(json.rows.length).toBeTruthy();
|
|
54
|
+
expect(json.rows[0]).toHaveProperty('map_id');
|
|
55
|
+
expect(json.rows[0]).toHaveProperty('name');
|
|
56
|
+
expect(json.rows[0]).toHaveProperty('map_key');
|
|
57
|
+
expect(json).toHaveProperty('fields');
|
|
58
|
+
expect(json.fields[0]).toHaveProperty('name');
|
|
59
|
+
expect(json.fields[0]).toHaveProperty('type');
|
|
60
|
+
expect(json.fields[0]).toHaveProperty('label');
|
|
61
|
+
}, 15000);
|
|
62
|
+
|
|
63
|
+
test('GET /gis-map/:id', async () => {
|
|
64
|
+
const res = await injectWithHeaders({
|
|
65
|
+
method: 'GET',
|
|
66
|
+
url: `/api/gis-map/${testKey}`,
|
|
67
|
+
headers: { uid: user.uid, user_type: user.user_type }
|
|
68
|
+
});
|
|
69
|
+
expect(res.statusCode).toBe(200);
|
|
70
|
+
expect(res.headers['content-type']).toBe('application/json; charset=utf-8');
|
|
71
|
+
const json = res.json();
|
|
72
|
+
Object.assign(obj, { 'GET/gis-map/:id': json });
|
|
73
|
+
expect(json).toHaveProperty('map_id');
|
|
74
|
+
expect(json.map_id).toBe(testKey);
|
|
75
|
+
expect(json).toHaveProperty('name');
|
|
76
|
+
expect(json).toHaveProperty('map_key');
|
|
77
|
+
expect(json).toHaveProperty('widgets');
|
|
78
|
+
expect(json).toHaveProperty('layers');
|
|
79
|
+
expect(json).toHaveProperty('center');
|
|
80
|
+
expect(Array.isArray(json.center)).toBeTruthy();
|
|
81
|
+
expect(json.center[0]).toBe(30);
|
|
82
|
+
expect(json.center[1]).toBe(50);
|
|
83
|
+
// expect(json.fields[0]).toHaveProperty('name');
|
|
84
|
+
// expect(json.fields[0]).toHaveProperty('type');
|
|
85
|
+
// expect(json.fields[0]).toHaveProperty('label');
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const name = [testKey, randomUUID()].join('-');
|
|
89
|
+
|
|
90
|
+
test('POST /gis-map', async () => {
|
|
91
|
+
const res = await injectWithHeaders({
|
|
92
|
+
method: 'POST',
|
|
93
|
+
url: '/api/gis-map',
|
|
94
|
+
payload: {
|
|
95
|
+
name,
|
|
96
|
+
map_key: name,
|
|
97
|
+
keywords: [testKey],
|
|
98
|
+
widgets: [{
|
|
99
|
+
type: 'legend',
|
|
100
|
+
position: 'bottom-right',
|
|
101
|
+
}],
|
|
102
|
+
layers: ['dbcb186818e3', '3c95e341465d'],
|
|
103
|
+
},
|
|
104
|
+
headers: { uid: user.uid, user_type: user.user_type }
|
|
105
|
+
});
|
|
106
|
+
expect(res.statusCode).toBe(200);
|
|
107
|
+
expect(res.headers['content-type']).toBe('application/json; charset=utf-8');
|
|
108
|
+
const json = res.json();
|
|
109
|
+
Object.assign(obj, { 'POST/gis-map': json });
|
|
110
|
+
expect(json).toHaveProperty('map_id');
|
|
111
|
+
expect(json).toHaveProperty('widgets');
|
|
112
|
+
expect(Array.isArray(json.widgets)).toBeTruthy();
|
|
113
|
+
expect(json.widgets[0]).toHaveProperty('type');
|
|
114
|
+
expect(json.widgets[0].type).toBe('legend');
|
|
115
|
+
expect(json).toHaveProperty('layers');
|
|
116
|
+
expect(Array.isArray(json.layers)).toBeTruthy();
|
|
117
|
+
expect(json.layers[0]).toBe('dbcb186818e3');
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test('GET /gis-widget/:map/:id', async () => {
|
|
121
|
+
const res = await injectWithHeaders({
|
|
122
|
+
method: 'GET',
|
|
123
|
+
url: `/api/gis-widget/${testKey}`,
|
|
124
|
+
headers: { uid: user.uid, user_type: user.user_type }
|
|
125
|
+
});
|
|
126
|
+
expect(res.statusCode).toBe(200);
|
|
127
|
+
expect(res.headers['content-type']).toBe('application/json; charset=utf-8');
|
|
128
|
+
const json = res.json();
|
|
129
|
+
Object.assign(obj, { 'GET/gis-widget/:map': json });
|
|
130
|
+
expect(json).toHaveProperty('rows');
|
|
131
|
+
expect(json).toHaveProperty('fields');
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test('GET /gis-widget/:map/:id', async () => {
|
|
135
|
+
await dataInsert({
|
|
136
|
+
table: 'gis.widgets',
|
|
137
|
+
id: name,
|
|
138
|
+
data: {
|
|
139
|
+
widget_id: name,
|
|
140
|
+
map_id: testKey,
|
|
141
|
+
type: 'card',
|
|
142
|
+
title: name,
|
|
143
|
+
config: {
|
|
144
|
+
items: [{
|
|
145
|
+
label: 'Карта тимчасових споруд',
|
|
146
|
+
url: '/map/ts',
|
|
147
|
+
}],
|
|
148
|
+
},
|
|
149
|
+
position: 'top-right',
|
|
150
|
+
},
|
|
151
|
+
uid: '1',
|
|
152
|
+
});
|
|
153
|
+
const res = await injectWithHeaders({
|
|
154
|
+
method: 'GET',
|
|
155
|
+
url: `/api/gis-widget/${testKey}/${name}`,
|
|
156
|
+
headers: { uid: user.uid, user_type: user.user_type }
|
|
157
|
+
});
|
|
158
|
+
expect(res.statusCode).toBe(200);
|
|
159
|
+
expect(res.headers['content-type']).toBe('application/json; charset=utf-8');
|
|
160
|
+
const json = res.json();
|
|
161
|
+
Object.assign(obj, { 'GET/gis-widget/:map/:id': json });
|
|
162
|
+
expect(json).toHaveProperty('widget_id');
|
|
163
|
+
expect(json).toHaveProperty('type');
|
|
164
|
+
expect(json).toHaveProperty('title');
|
|
165
|
+
expect(json).toHaveProperty('config');
|
|
166
|
+
expect(json).toHaveProperty('position');
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
test('PUT /gis-widget/:map/:id', async () => {
|
|
170
|
+
const res = await injectWithHeaders({
|
|
171
|
+
method: 'PUT',
|
|
172
|
+
url: `/api/gis-widget/${testKey}/${name}`,
|
|
173
|
+
payload: {
|
|
174
|
+
type: 'card1',
|
|
175
|
+
},
|
|
176
|
+
headers: { uid: user.uid, user_type: user.user_type }
|
|
177
|
+
});
|
|
178
|
+
expect(res.statusCode).toBe(200);
|
|
179
|
+
expect(res.headers['content-type']).toBe('application/json; charset=utf-8');
|
|
180
|
+
const json = res.json();
|
|
181
|
+
Object.assign(obj, { 'PUT/gis-widget/:map/:id': json });
|
|
182
|
+
expect(json).toHaveProperty('map_id');
|
|
183
|
+
expect(json.map_id).toBe(testKey);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
test('DELETE /gis-widget/:map/:id', async () => {
|
|
187
|
+
const res = await injectWithHeaders({
|
|
188
|
+
method: 'DELETE',
|
|
189
|
+
url: `/api/gis-widget/${testKey}/${name}`,
|
|
190
|
+
headers: { uid: user.uid, user_type: user.user_type }
|
|
191
|
+
});
|
|
192
|
+
expect(res.statusCode).toBe(200);
|
|
193
|
+
expect(res.headers['content-type']).toBe('application/json; charset=utf-8');
|
|
194
|
+
const json = res.json();
|
|
195
|
+
Object.assign(obj, { 'DELETE/gis-widget/:map/:id': json });
|
|
196
|
+
expect(json).toHaveProperty('map_id');
|
|
197
|
+
expect(json.map_id).toBe(testKey);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
test('PUT /gis-map/:id', async () => {
|
|
201
|
+
const res = await injectWithHeaders({
|
|
202
|
+
method: 'PUT',
|
|
203
|
+
url: `/api/gis-map/${testKey}`,
|
|
204
|
+
payload: {
|
|
205
|
+
keywords: [testKey],
|
|
206
|
+
description: testKey,
|
|
207
|
+
},
|
|
208
|
+
headers: { uid: user.uid, user_type: user.user_type }
|
|
209
|
+
});
|
|
210
|
+
expect(res.statusCode).toBe(200);
|
|
211
|
+
expect(res.headers['content-type']).toBe('application/json; charset=utf-8');
|
|
212
|
+
const json = res.json();
|
|
213
|
+
Object.assign(obj, { 'PUT/gis-map/:id': json });
|
|
214
|
+
expect(json).toHaveProperty('map_id');
|
|
215
|
+
expect(json.map_id).toBe(testKey);
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
test('DELETE /gis-map/:id', async () => {
|
|
219
|
+
const res = await injectWithHeaders({
|
|
220
|
+
method: 'DELETE',
|
|
221
|
+
url: `/api/gis-map/${testKey}`,
|
|
222
|
+
headers: { uid: user.uid, user_type: user.user_type }
|
|
223
|
+
});
|
|
224
|
+
expect(res.statusCode).toBe(200);
|
|
225
|
+
expect(res.headers['content-type']).toBe('application/json; charset=utf-8');
|
|
226
|
+
const json = res.json();
|
|
227
|
+
Object.assign(obj, { 'DELETE/gis-map/:id': json });
|
|
228
|
+
expect(json).toHaveProperty('map_id');
|
|
229
|
+
expect(json.map_id).toBe(testKey);
|
|
230
|
+
});
|
|
231
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BadRequestError, NotFoundError } from "@opengis/fastify-table/errors.js";
|
|
2
|
+
import { pgClients, dataUpsert } from "@opengis/fastify-table/utils.js";
|
|
3
|
+
|
|
4
|
+
export default async function editMetadata({ id, type, body, uid }, pg = pgClients.client) {
|
|
5
|
+
if (!type) {
|
|
6
|
+
throw BadRequestError('not enough params: type');
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const q = {
|
|
10
|
+
raster: 'select 1 from gis.rasters where raster_id = $1',
|
|
11
|
+
css: 'select 1 from gis.cartocss where cartocss_id = $1',
|
|
12
|
+
dataset: 'select 1 from gis.dataset where dataset_id = $1',
|
|
13
|
+
service: 'select 1 from gis.services where service_id = $1',
|
|
14
|
+
}[type];
|
|
15
|
+
|
|
16
|
+
if (!q) {
|
|
17
|
+
throw BadRequestError('invalid params: type');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const exists = await pg.query(q, [id]).then(r => r.rowCount || 0);
|
|
21
|
+
|
|
22
|
+
if (!exists) {
|
|
23
|
+
throw NotFoundError(`${type} not found: ${id}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const data = await dataUpsert({
|
|
27
|
+
pg,
|
|
28
|
+
id: id,
|
|
29
|
+
table: 'gis.metadata',
|
|
30
|
+
data: { ...body, type: type, layer_id: id },
|
|
31
|
+
uid,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return data;
|
|
35
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { handlebars, getTemplate } from "@opengis/fastify-table/utils.js";
|
|
2
|
+
import { BadRequestError } from "@opengis/fastify-table/errors.js";
|
|
3
|
+
|
|
4
|
+
// currently unused
|
|
5
|
+
export default async function metadataXml({ id }) {
|
|
6
|
+
if (!id) {
|
|
7
|
+
throw BadRequestError('not enough params: id');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const pt = await getTemplate('templates', 'ISO19136_2017_gml_template');
|
|
11
|
+
const data = await handlebars.compile(pt)({ id });
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
headers: {
|
|
15
|
+
'Content-Type': 'text/xml; charset=utf-8',
|
|
16
|
+
},
|
|
17
|
+
data
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// import metadataXML from './functions/metadataXML.js';
|
|
2
|
+
import editMetadata from './functions/editMetadata.js';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
editMetadataSchema,
|
|
6
|
+
} from './metadata.schema.js';
|
|
7
|
+
|
|
8
|
+
const privateParams = { config: { policy: 'L1', package: 'gis' } };
|
|
9
|
+
// const publicParams = { config: { policy: 'L0', package: 'gis' } };
|
|
10
|
+
|
|
11
|
+
async function route(app) {
|
|
12
|
+
/*app.get('/xml/:id', { ...publicParams, schema: metadataXMLSchema }, async ({ params }, reply) => {
|
|
13
|
+
const result = await metadataXML({ id: params.id });
|
|
14
|
+
return reply.headers(result.headers).send(result.data);
|
|
15
|
+
});*/
|
|
16
|
+
app.post('/gis-metadata/:type/:id', { ...privateParams, schema: editMetadataSchema }, async ({ params, body, user, pg }) => {
|
|
17
|
+
const result = await editMetadata({
|
|
18
|
+
id: params.id,
|
|
19
|
+
type: params.type,
|
|
20
|
+
body,
|
|
21
|
+
uid: user?.uid,
|
|
22
|
+
}, pg);
|
|
23
|
+
return result;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export default route;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { getPGAsync } from '@opengis/fastify-table/utils.js';
|
|
4
|
+
|
|
5
|
+
import { build, injectWithHeaders } from '../../../test/helper.js';
|
|
6
|
+
|
|
7
|
+
let pg;
|
|
8
|
+
|
|
9
|
+
beforeAll(async () => {
|
|
10
|
+
await build();
|
|
11
|
+
|
|
12
|
+
pg = await getPGAsync();
|
|
13
|
+
|
|
14
|
+
await cleanUp('before');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
afterAll(async () => {
|
|
18
|
+
await cleanUp('after');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const testId = 'testCss';
|
|
22
|
+
const user = { id: '2', type: 'admin' };
|
|
23
|
+
|
|
24
|
+
const cleanUp = async (when) => {
|
|
25
|
+
if (!pg) return;
|
|
26
|
+
const rowCount = await pg.query('delete from gis.cartocss where cartocss_id=$1', [testId]).then(r => r.rowCount || 0);
|
|
27
|
+
const rowCount3 = await pg.query('delete from gis.metadata where metadata_id=$1', [testId]).then(r => r.rowCount || 0);
|
|
28
|
+
console.log(`clean up finished: ${when}`, rowCount, rowCount3);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
describe('GIS routes', () => {
|
|
32
|
+
test('POST /gis-metadata/:type/:id returns 200', async () => {
|
|
33
|
+
await pg.query('insert into gis.cartocss(cartocss_id,name) values($1,$2)', [testId, 'unit-test']).catch(err => console.error(err));
|
|
34
|
+
const res = await injectWithHeaders({
|
|
35
|
+
method: 'POST',
|
|
36
|
+
url: `/api/gis-metadata/css/${testId}`,
|
|
37
|
+
payload: {
|
|
38
|
+
layer_id: testId
|
|
39
|
+
},
|
|
40
|
+
headers: { uid: user.id, user_type: user.type }
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
expect(res.statusCode).toBe(200);
|
|
44
|
+
expect(res.body).toHaveProperty('metadata_id');
|
|
45
|
+
expect(res.body.metadata_id).toBe(testId);
|
|
46
|
+
});
|
|
47
|
+
});
|