@golemio/gardens 1.0.4-dev.675491008 → 1.1.0
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/LICENSE +1 -1
- package/db/example/.config.json +3 -0
- package/db/example/00_truncate_tables.sql +1 -0
- package/db/example/01_gardens.sql +6 -0
- package/db/migrations/postgresql/.config.json +3 -0
- package/db/migrations/postgresql/20221027165643-init-mongo-to-pg.js +51 -0
- package/db/migrations/postgresql/package.json +3 -0
- package/db/migrations/postgresql/sqls/20221027165643-init-mongo-to-pg-down.sql +2 -0
- package/db/migrations/postgresql/sqls/20221027165643-init-mongo-to-pg-up.sql +37 -0
- package/db/migrations/postgresql/sqls/package.json +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/integration-engine/datasources/GardensDataSourceFactory.d.ts +3 -0
- package/dist/integration-engine/datasources/GardensDataSourceFactory.js +22 -0
- package/dist/integration-engine/datasources/GardensDataSourceFactory.js.map +1 -0
- package/dist/integration-engine/index.d.ts +2 -3
- package/dist/integration-engine/index.js +4 -3
- package/dist/integration-engine/index.js.map +1 -1
- package/dist/integration-engine/repositories/GardensRepository.d.ts +6 -0
- package/dist/integration-engine/repositories/GardensRepository.js +39 -0
- package/dist/integration-engine/repositories/GardensRepository.js.map +1 -0
- package/dist/integration-engine/transformations/GardensTransformation.d.ts +9 -0
- package/dist/integration-engine/transformations/GardensTransformation.js +58 -0
- package/dist/integration-engine/transformations/GardensTransformation.js.map +1 -0
- package/dist/integration-engine/workers/GardensWorker.d.ts +5 -0
- package/dist/integration-engine/workers/GardensWorker.js +14 -0
- package/dist/integration-engine/workers/GardensWorker.js.map +1 -0
- package/dist/integration-engine/workers/index.d.ts +2 -0
- package/dist/integration-engine/workers/index.js +6 -0
- package/dist/integration-engine/workers/index.js.map +1 -0
- package/dist/integration-engine/workers/tasks/RefreshDataInDBTask.d.ts +10 -0
- package/dist/integration-engine/workers/tasks/RefreshDataInDBTask.js +35 -0
- package/dist/integration-engine/workers/tasks/RefreshDataInDBTask.js.map +1 -0
- package/dist/output-gateway/GardensRouter.d.ts +1 -8
- package/dist/output-gateway/GardensRouter.js +1 -19
- package/dist/output-gateway/GardensRouter.js.map +1 -1
- package/dist/output-gateway/index.d.ts +1 -1
- package/dist/output-gateway/index.js +1 -1
- package/dist/output-gateway/index.js.map +1 -1
- package/dist/output-gateway/repositories/FilterHelper.d.ts +8 -0
- package/dist/output-gateway/repositories/FilterHelper.js +47 -0
- package/dist/output-gateway/repositories/FilterHelper.js.map +1 -0
- package/dist/output-gateway/repositories/GardensRepository.d.ts +14 -0
- package/dist/output-gateway/repositories/GardensRepository.js +146 -0
- package/dist/output-gateway/repositories/GardensRepository.js.map +1 -0
- package/dist/schema-definitions/Gardens.d.ts +28 -0
- package/dist/schema-definitions/Gardens.js +8 -0
- package/dist/schema-definitions/Gardens.js.map +1 -0
- package/dist/schema-definitions/datasources/GardensJsonSchema.d.ts +27 -0
- package/dist/schema-definitions/datasources/GardensJsonSchema.js +45 -0
- package/dist/schema-definitions/datasources/GardensJsonSchema.js.map +1 -0
- package/dist/schema-definitions/index.d.ts +1 -11
- package/dist/schema-definitions/index.js +9 -59
- package/dist/schema-definitions/index.js.map +1 -1
- package/dist/schema-definitions/models/GardensModel.d.ts +28 -0
- package/dist/schema-definitions/models/GardensModel.js +67 -0
- package/dist/schema-definitions/models/GardensModel.js.map +1 -0
- package/docs/gardens_erd.png +0 -0
- package/docs/implementation_documentation.md +69 -0
- package/docs/openapi.yaml +264 -0
- package/package.json +16 -11
- package/db/example/mongo_data/dataplatform/gardens.bson +0 -0
- package/db/example/mongo_data/dataplatform/gardens.metadata.json +0 -1
- package/dist/integration-engine/GardensTransformation.d.ts +0 -7
- package/dist/integration-engine/GardensTransformation.js +0 -88
- package/dist/integration-engine/GardensTransformation.js.map +0 -1
- package/dist/integration-engine/GardensWorker.d.ts +0 -8
- package/dist/integration-engine/GardensWorker.js +0 -58
- package/dist/integration-engine/GardensWorker.js.map +0 -1
- package/dist/integration-engine/queueDefinitions.d.ts +0 -3
- package/dist/integration-engine/queueDefinitions.js +0 -26
- package/dist/integration-engine/queueDefinitions.js.map +0 -1
- package/dist/output-gateway/GardensModel.d.ts +0 -7
- package/dist/output-gateway/GardensModel.js +0 -17
- package/dist/output-gateway/GardensModel.js.map +0 -1
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
openapi: 3.0.3
|
|
2
|
+
|
|
3
|
+
info:
|
|
4
|
+
title: 🌳 Gardens
|
|
5
|
+
description: Locations and Description of Gardens
|
|
6
|
+
version: 1.0.0
|
|
7
|
+
contact:
|
|
8
|
+
name: Golemio Prague Data Plaform
|
|
9
|
+
email: golemio@operatorict.cz
|
|
10
|
+
url: https://golemio.cz
|
|
11
|
+
|
|
12
|
+
servers:
|
|
13
|
+
- url: https://api.golemio.cz/v2
|
|
14
|
+
description: Main (production) server
|
|
15
|
+
- url: https://rabin.golemio.cz/v2
|
|
16
|
+
description: Test (development) server
|
|
17
|
+
|
|
18
|
+
tags:
|
|
19
|
+
- name: 🌳 Gardens
|
|
20
|
+
description: 💡 Locations and Description of Gardens
|
|
21
|
+
|
|
22
|
+
paths:
|
|
23
|
+
/gardens/:
|
|
24
|
+
get:
|
|
25
|
+
summary: GET All Gardens
|
|
26
|
+
operationId: GETAllGardens
|
|
27
|
+
description: ""
|
|
28
|
+
tags:
|
|
29
|
+
- 🌳 Gardens
|
|
30
|
+
parameters:
|
|
31
|
+
- name: latlng
|
|
32
|
+
in: query
|
|
33
|
+
description: Sorting by location (Latitude and Longitude separated by comma,
|
|
34
|
+
latitude first).
|
|
35
|
+
required: false
|
|
36
|
+
example: 50.124935,14.457204
|
|
37
|
+
schema:
|
|
38
|
+
type: string
|
|
39
|
+
- name: range
|
|
40
|
+
in: query
|
|
41
|
+
description: Filter by distance from latlng in meters (range query). Depends on
|
|
42
|
+
the latlng parameter.
|
|
43
|
+
required: false
|
|
44
|
+
example: "5000"
|
|
45
|
+
schema:
|
|
46
|
+
type: number
|
|
47
|
+
- name: districts
|
|
48
|
+
in: query
|
|
49
|
+
description: Filter by Prague city districts (slug) separated by comma.
|
|
50
|
+
required: false
|
|
51
|
+
example: praha-4
|
|
52
|
+
schema:
|
|
53
|
+
type: array
|
|
54
|
+
items: {}
|
|
55
|
+
- name: limit
|
|
56
|
+
in: query
|
|
57
|
+
description: Limits number of retrieved items. The maximum is 10000 (default
|
|
58
|
+
value).
|
|
59
|
+
required: false
|
|
60
|
+
example: "10"
|
|
61
|
+
schema:
|
|
62
|
+
type: number
|
|
63
|
+
- name: offset
|
|
64
|
+
in: query
|
|
65
|
+
description: Number of the first items that are skipped.
|
|
66
|
+
required: false
|
|
67
|
+
example: "0"
|
|
68
|
+
schema:
|
|
69
|
+
type: number
|
|
70
|
+
- name: updatedSince
|
|
71
|
+
in: query
|
|
72
|
+
description: Filters all results with older updated_at than this parameter
|
|
73
|
+
required: false
|
|
74
|
+
example: 2019-05-18T07:38:37.000Z
|
|
75
|
+
schema:
|
|
76
|
+
type: string
|
|
77
|
+
responses:
|
|
78
|
+
"200":
|
|
79
|
+
description: OK
|
|
80
|
+
headers: {}
|
|
81
|
+
content:
|
|
82
|
+
application/json; charset=utf-8:
|
|
83
|
+
schema:
|
|
84
|
+
type: object
|
|
85
|
+
properties:
|
|
86
|
+
type:
|
|
87
|
+
type: string
|
|
88
|
+
example: FeatureCollection
|
|
89
|
+
features:
|
|
90
|
+
type: array
|
|
91
|
+
items:
|
|
92
|
+
$ref: "#/components/schemas/Garden"
|
|
93
|
+
required:
|
|
94
|
+
- type
|
|
95
|
+
|
|
96
|
+
"401":
|
|
97
|
+
$ref: "#/components/responses/UnauthorizedError"
|
|
98
|
+
"403":
|
|
99
|
+
description: Forbidden
|
|
100
|
+
headers: {}
|
|
101
|
+
content:
|
|
102
|
+
application/json; charset=utf-8:
|
|
103
|
+
schema:
|
|
104
|
+
type: object
|
|
105
|
+
properties:
|
|
106
|
+
error_message:
|
|
107
|
+
type: string
|
|
108
|
+
error_status:
|
|
109
|
+
type: number
|
|
110
|
+
required:
|
|
111
|
+
- error_message
|
|
112
|
+
- error_status
|
|
113
|
+
examples:
|
|
114
|
+
response:
|
|
115
|
+
value:
|
|
116
|
+
error_message: Forbidden
|
|
117
|
+
error_status: 403
|
|
118
|
+
|
|
119
|
+
/gardens/{id}:
|
|
120
|
+
get:
|
|
121
|
+
summary: GET Gardens
|
|
122
|
+
operationId: GETGardens
|
|
123
|
+
description: ""
|
|
124
|
+
tags:
|
|
125
|
+
- 🌳 Gardens
|
|
126
|
+
parameters:
|
|
127
|
+
- name: id
|
|
128
|
+
in: path
|
|
129
|
+
description: Identifier of the garden.
|
|
130
|
+
required: true
|
|
131
|
+
example: bertramka
|
|
132
|
+
schema:
|
|
133
|
+
type: string
|
|
134
|
+
responses:
|
|
135
|
+
"200":
|
|
136
|
+
description: OK
|
|
137
|
+
headers: {}
|
|
138
|
+
content:
|
|
139
|
+
application/json; charset=utf-8:
|
|
140
|
+
schema:
|
|
141
|
+
$ref: "#/components/schemas/Garden"
|
|
142
|
+
"401":
|
|
143
|
+
$ref: "#/components/responses/UnauthorizedError"
|
|
144
|
+
"403":
|
|
145
|
+
description: Forbidden
|
|
146
|
+
headers: {}
|
|
147
|
+
content:
|
|
148
|
+
application/json; charset=utf-8:
|
|
149
|
+
schema:
|
|
150
|
+
type: object
|
|
151
|
+
properties:
|
|
152
|
+
error_message:
|
|
153
|
+
type: string
|
|
154
|
+
error_status:
|
|
155
|
+
type: number
|
|
156
|
+
required:
|
|
157
|
+
- error_message
|
|
158
|
+
- error_status
|
|
159
|
+
examples:
|
|
160
|
+
response:
|
|
161
|
+
value:
|
|
162
|
+
error_message: Forbidden
|
|
163
|
+
error_status: 403
|
|
164
|
+
"404":
|
|
165
|
+
description: Not Found
|
|
166
|
+
headers: {}
|
|
167
|
+
content:
|
|
168
|
+
application/json; charset=utf-8:
|
|
169
|
+
schema:
|
|
170
|
+
type: object
|
|
171
|
+
properties:
|
|
172
|
+
error_message:
|
|
173
|
+
type: string
|
|
174
|
+
error_status:
|
|
175
|
+
type: number
|
|
176
|
+
required:
|
|
177
|
+
- error_message
|
|
178
|
+
- error_status
|
|
179
|
+
examples:
|
|
180
|
+
response:
|
|
181
|
+
value:
|
|
182
|
+
error_message: Not Found
|
|
183
|
+
error_status: 404
|
|
184
|
+
|
|
185
|
+
components:
|
|
186
|
+
responses:
|
|
187
|
+
UnauthorizedError:
|
|
188
|
+
description: API key is missing or invalid
|
|
189
|
+
headers:
|
|
190
|
+
WWW_Authenticate:
|
|
191
|
+
schema:
|
|
192
|
+
type: string
|
|
193
|
+
schemas:
|
|
194
|
+
Garden:
|
|
195
|
+
type: object
|
|
196
|
+
properties:
|
|
197
|
+
geometry:
|
|
198
|
+
type: object
|
|
199
|
+
properties:
|
|
200
|
+
type:
|
|
201
|
+
type: string
|
|
202
|
+
example: Point
|
|
203
|
+
coordinates:
|
|
204
|
+
type: array
|
|
205
|
+
items:
|
|
206
|
+
type: number
|
|
207
|
+
example:
|
|
208
|
+
- 14.4633
|
|
209
|
+
- 50.07827
|
|
210
|
+
properties:
|
|
211
|
+
type: object
|
|
212
|
+
properties:
|
|
213
|
+
address:
|
|
214
|
+
type: object
|
|
215
|
+
properties:
|
|
216
|
+
address_formatted:
|
|
217
|
+
type: string
|
|
218
|
+
example: Dělnická 213/10, 17000 Praha-Holešovice, Česko
|
|
219
|
+
description:
|
|
220
|
+
type: string
|
|
221
|
+
example: Mozartova busta v zahradě legendární usedlosti stojí na vyvýšeném místě.
|
|
222
|
+
district:
|
|
223
|
+
type: string
|
|
224
|
+
example: praha-15
|
|
225
|
+
id:
|
|
226
|
+
type: string
|
|
227
|
+
example: bertramka
|
|
228
|
+
image:
|
|
229
|
+
type: object
|
|
230
|
+
properties:
|
|
231
|
+
url:
|
|
232
|
+
type: string
|
|
233
|
+
example: http://www.praha.eu/public/5c/7c/31/96820_4_bertramka_08.jpg
|
|
234
|
+
name:
|
|
235
|
+
type: string
|
|
236
|
+
example: Bertramka
|
|
237
|
+
properties:
|
|
238
|
+
type: array
|
|
239
|
+
items:
|
|
240
|
+
type: object
|
|
241
|
+
properties:
|
|
242
|
+
id:
|
|
243
|
+
type: string
|
|
244
|
+
example: doba
|
|
245
|
+
description:
|
|
246
|
+
type: string
|
|
247
|
+
example: Otevírací doba
|
|
248
|
+
value:
|
|
249
|
+
type: string
|
|
250
|
+
example: Celoročně duben až říjen 9-18 hod., listopad až březen 9:30-16 hod.
|
|
251
|
+
required:
|
|
252
|
+
- id
|
|
253
|
+
updated_at:
|
|
254
|
+
type: string
|
|
255
|
+
example: "2019-05-18T07:38:37.000Z"
|
|
256
|
+
url:
|
|
257
|
+
type: string
|
|
258
|
+
example: http://www.praha.eu/jnp/cz/co_delat_v_praze/parky/bertramka/bertramka_text.html
|
|
259
|
+
required:
|
|
260
|
+
- id
|
|
261
|
+
- name
|
|
262
|
+
type:
|
|
263
|
+
type: string
|
|
264
|
+
example: Feature
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golemio/gardens",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Golemio Gardens Module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"build": "rimraf ./dist && ttsc -p ./tsconfig.build.json",
|
|
9
9
|
"build-minimal": "run-s 'build --sourceMap false --declaration false'",
|
|
10
10
|
"build-watch": "run-s 'build --watch --preserveWatchOutput'",
|
|
11
|
-
"
|
|
11
|
+
"migrate-db": "golemio migrate-db up --postgres",
|
|
12
|
+
"pretest": "golemio import-db-data --postgres",
|
|
12
13
|
"test": "cross-env NODE_ENV=test TS_NODE_COMPILER='ttypescript' mocha --exit --check-leaks --timeout 120000 -r ts-node/register -r dotenv/config 'test/**/*.test.ts'",
|
|
13
14
|
"test-debug": "run-s 'test --inspect-brk=9230'",
|
|
14
15
|
"code-coverage": "nyc run-s 'test -r source-map-support/register'",
|
|
@@ -25,13 +26,16 @@
|
|
|
25
26
|
"url": "https://gitlab.com/operator-ict/golemio/code/modules/gardens"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
|
-
"@commitlint/cli": "^
|
|
29
|
-
"@commitlint/config-conventional": "^
|
|
30
|
-
"@golemio/
|
|
31
|
-
"@golemio/
|
|
29
|
+
"@commitlint/cli": "^16.2.1",
|
|
30
|
+
"@commitlint/config-conventional": "^16.2.1",
|
|
31
|
+
"@golemio/cli": "1.3.2",
|
|
32
|
+
"@golemio/core": "1.2.21",
|
|
33
|
+
"@golemio/db-common": "1.0.1",
|
|
34
|
+
"@golemio/eslint-config": "^1.1.0",
|
|
32
35
|
"@ovos-media/ts-transform-paths": "^1.7.18-1",
|
|
33
36
|
"@types/chai": "4.2.3",
|
|
34
37
|
"@types/chai-as-promised": "7.1.2",
|
|
38
|
+
"@types/geojson": "^7946.0.10",
|
|
35
39
|
"@types/mocha": "^8.2.0",
|
|
36
40
|
"@types/node": "^16.11.35",
|
|
37
41
|
"@types/sinon": "^9.0.10",
|
|
@@ -40,12 +44,12 @@
|
|
|
40
44
|
"chai-as-promised": "7.1.1",
|
|
41
45
|
"cross-env": "^7.0.3",
|
|
42
46
|
"dotenv": "^8.2.0",
|
|
43
|
-
"eslint": "^
|
|
47
|
+
"eslint": "^8.1.1",
|
|
44
48
|
"husky": "^4.3.7",
|
|
45
49
|
"mocha": "^8.2.1",
|
|
46
50
|
"npm-run-all": "^4.1.5",
|
|
47
51
|
"nyc": "^15.1.0",
|
|
48
|
-
"prettier": "^2.
|
|
52
|
+
"prettier": "^2.7.1",
|
|
49
53
|
"pretty-quick": "^3.1.0",
|
|
50
54
|
"rimraf": "^3.0.2",
|
|
51
55
|
"sinon": "^9.2.3",
|
|
@@ -53,10 +57,11 @@
|
|
|
53
57
|
"supertest": "^6.0.1",
|
|
54
58
|
"ts-node": "^10.7.0",
|
|
55
59
|
"ttypescript": "^1.5.13",
|
|
56
|
-
"typedoc": "^0.
|
|
57
|
-
"typescript": "4.
|
|
60
|
+
"typedoc": "^0.23.21",
|
|
61
|
+
"typescript": "4.7.2"
|
|
58
62
|
},
|
|
63
|
+
"dependencies": {},
|
|
59
64
|
"peerDependencies": {
|
|
60
|
-
"@golemio/core": "^1.
|
|
65
|
+
"@golemio/core": "^1.2.21"
|
|
61
66
|
}
|
|
62
67
|
}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"dataplatform.gardens"},{"v":2,"key":{"properties.id":1},"name":"properties.id_1","ns":"dataplatform.gardens"},{"v":2,"key":{"geometry":"2dsphere"},"name":"geometry_2dsphere","ns":"dataplatform.gardens","2dsphereIndexVersion":3}],"uuid":"b10e082f741c4cccb5ae29168f679def"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BaseTransformation, ITransformation } from "@golemio/core/dist/integration-engine/transformations";
|
|
2
|
-
export declare class GardensTransformation extends BaseTransformation implements ITransformation {
|
|
3
|
-
name: string;
|
|
4
|
-
constructor();
|
|
5
|
-
protected transformElement: (element: any) => Promise<any>;
|
|
6
|
-
private getPropertyDescription;
|
|
7
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.GardensTransformation = void 0;
|
|
13
|
-
const transformations_1 = require("@golemio/core/dist/integration-engine/transformations");
|
|
14
|
-
const index_1 = require("../schema-definitions/index");
|
|
15
|
-
class GardensTransformation extends transformations_1.BaseTransformation {
|
|
16
|
-
constructor() {
|
|
17
|
-
super();
|
|
18
|
-
this.transformElement = (element) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
const res = {
|
|
20
|
-
geometry: {
|
|
21
|
-
coordinates: element.coordinates,
|
|
22
|
-
type: "Point",
|
|
23
|
-
},
|
|
24
|
-
properties: {
|
|
25
|
-
address: element.address ? { address_formatted: element.address } : null,
|
|
26
|
-
description: element.description ? element.description : null,
|
|
27
|
-
district: element.district ? element.district : null,
|
|
28
|
-
id: element.slug,
|
|
29
|
-
image: {
|
|
30
|
-
url: element.image ? element.image : null,
|
|
31
|
-
},
|
|
32
|
-
name: element.name,
|
|
33
|
-
properties: [],
|
|
34
|
-
updated_at: new Date().getTime(),
|
|
35
|
-
url: element.url ? element.url : null,
|
|
36
|
-
},
|
|
37
|
-
type: "Feature",
|
|
38
|
-
};
|
|
39
|
-
res.properties.properties = Object.getOwnPropertyNames(element)
|
|
40
|
-
.map((item) => {
|
|
41
|
-
if (item.indexOf("properties_") !== -1 && element[item] && element[item] !== "") {
|
|
42
|
-
const propertyId = item.replace("properties_", "");
|
|
43
|
-
return {
|
|
44
|
-
description: this.getPropertyDescription(propertyId),
|
|
45
|
-
id: propertyId,
|
|
46
|
-
value: element[item],
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
return null;
|
|
50
|
-
})
|
|
51
|
-
.filter((item) => item);
|
|
52
|
-
return res;
|
|
53
|
-
});
|
|
54
|
-
this.getPropertyDescription = (id) => {
|
|
55
|
-
switch (id) {
|
|
56
|
-
case "restaurace":
|
|
57
|
-
return "Občerstvení";
|
|
58
|
-
case "wc":
|
|
59
|
-
return "WC";
|
|
60
|
-
case "misto":
|
|
61
|
-
return "Zajímavosti";
|
|
62
|
-
case "kolo":
|
|
63
|
-
return "Cyklostezky";
|
|
64
|
-
case "hriste":
|
|
65
|
-
return "Dětské hřiště";
|
|
66
|
-
case "brusle":
|
|
67
|
-
return "Bruslení";
|
|
68
|
-
case "sport":
|
|
69
|
-
return "Sportovní hřiště";
|
|
70
|
-
case "mhd":
|
|
71
|
-
return "MHD";
|
|
72
|
-
case "parking":
|
|
73
|
-
return "Parkování";
|
|
74
|
-
case "cesty":
|
|
75
|
-
return "Povrch cest";
|
|
76
|
-
case "provoz":
|
|
77
|
-
return "Provozovatel";
|
|
78
|
-
case "doba":
|
|
79
|
-
return "Otevírací doba";
|
|
80
|
-
default:
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
this.name = index_1.Gardens.name;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
exports.GardensTransformation = GardensTransformation;
|
|
88
|
-
//# sourceMappingURL=GardensTransformation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GardensTransformation.js","sourceRoot":"","sources":["../../src/integration-engine/GardensTransformation.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2FAA4G;AAC5G,uDAAqC;AAErC,MAAa,qBAAsB,SAAQ,oCAAkB;IAGzD;QACI,KAAK,EAAE,CAAC;QAIF,qBAAgB,GAAG,CAAO,OAAY,EAAgB,EAAE;YAC9D,MAAM,GAAG,GAAwB;gBAC7B,QAAQ,EAAE;oBACN,WAAW,EAAE,OAAO,CAAC,WAAW;oBAChC,IAAI,EAAE,OAAO;iBAChB;gBACD,UAAU,EAAE;oBACR,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI;oBACxE,WAAW,EAAE,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CAAC;QACf,CAAC,CAAA,CAAC;QAEM,2BAAsB,GAAG,CAAC,EAAU,EAAiB,EAAE;YAC3D,QAAQ,EAAE,EAAE;gBACR,KAAK,YAAY;oBACb,OAAO,aAAa,CAAC;gBACzB,KAAK,IAAI;oBACL,OAAO,IAAI,CAAC;gBAChB,KAAK,OAAO;oBACR,OAAO,aAAa,CAAC;gBACzB,KAAK,MAAM;oBACP,OAAO,aAAa,CAAC;gBACzB,KAAK,QAAQ;oBACT,OAAO,eAAe,CAAC;gBAC3B,KAAK,QAAQ;oBACT,OAAO,UAAU,CAAC;gBACtB,KAAK,OAAO;oBACR,OAAO,kBAAkB,CAAC;gBAC9B,KAAK,KAAK;oBACN,OAAO,KAAK,CAAC;gBACjB,KAAK,SAAS;oBACV,OAAO,WAAW,CAAC;gBACvB,KAAK,OAAO;oBACR,OAAO,aAAa,CAAC;gBACzB,KAAK,QAAQ;oBACT,OAAO,cAAc,CAAC;gBAC1B,KAAK,MAAM;oBACP,OAAO,gBAAgB,CAAC;gBAC5B;oBACI,OAAO,IAAI,CAAC;aACnB;QACL,CAAC,CAAC;QAvEE,IAAI,CAAC,IAAI,GAAG,eAAO,CAAC,IAAI,CAAC;IAC7B,CAAC;CAuEJ;AA7ED,sDA6EC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { BaseWorker } from "@golemio/core/dist/integration-engine/workers";
|
|
2
|
-
export declare class GardensWorker extends BaseWorker {
|
|
3
|
-
private dataSource;
|
|
4
|
-
private transformation;
|
|
5
|
-
private model;
|
|
6
|
-
constructor();
|
|
7
|
-
refreshDataInDB: (msg: any) => Promise<void>;
|
|
8
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.GardensWorker = void 0;
|
|
13
|
-
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
14
|
-
const config_1 = require("@golemio/core/dist/integration-engine/config");
|
|
15
|
-
const datasources_1 = require("@golemio/core/dist/integration-engine/datasources");
|
|
16
|
-
const models_1 = require("@golemio/core/dist/integration-engine/models");
|
|
17
|
-
const workers_1 = require("@golemio/core/dist/integration-engine/workers");
|
|
18
|
-
const index_1 = require("../schema-definitions/index");
|
|
19
|
-
const _1 = require("./");
|
|
20
|
-
class GardensWorker extends workers_1.BaseWorker {
|
|
21
|
-
constructor() {
|
|
22
|
-
super();
|
|
23
|
-
this.refreshDataInDB = (msg) => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
const data = yield this.dataSource.getAll();
|
|
25
|
-
const transformedData = yield this.transformation.transform(data);
|
|
26
|
-
yield this.model.save(transformedData);
|
|
27
|
-
});
|
|
28
|
-
this.dataSource = new datasources_1.DataSource(index_1.Gardens.name + "DataSource", new datasources_1.HTTPProtocolStrategy({
|
|
29
|
-
headers: {
|
|
30
|
-
Authorization: "Basic " + config_1.config.datasources.OICTEndpointApikey,
|
|
31
|
-
},
|
|
32
|
-
method: "GET",
|
|
33
|
-
url: config_1.config.datasources.Gardens,
|
|
34
|
-
}), new datasources_1.JSONDataTypeStrategy({ resultsPath: "" }), new golemio_validator_1.Validator(index_1.Gardens.name + "DataSource", index_1.Gardens.datasourceMongooseSchemaObject));
|
|
35
|
-
this.model = new models_1.MongoModel(index_1.Gardens.name + "Model", {
|
|
36
|
-
identifierPath: "properties.id",
|
|
37
|
-
mongoCollectionName: index_1.Gardens.mongoCollectionName,
|
|
38
|
-
outputMongooseSchemaObject: index_1.Gardens.outputMongooseSchemaObject,
|
|
39
|
-
resultsPath: "properties",
|
|
40
|
-
savingType: "insertOrUpdate",
|
|
41
|
-
searchPath: (id, multiple) => (multiple ? { "properties.id": { $in: id } } : { "properties.id": id }),
|
|
42
|
-
updateValues: (a, b) => {
|
|
43
|
-
a.properties.name = b.properties.name;
|
|
44
|
-
a.properties.image = b.properties.image;
|
|
45
|
-
a.properties.description = b.properties.description;
|
|
46
|
-
a.properties.url = b.properties.url;
|
|
47
|
-
a.properties.address = b.properties.address;
|
|
48
|
-
a.properties.district = b.properties.district;
|
|
49
|
-
a.properties.properties = b.properties.properties;
|
|
50
|
-
a.properties.updated_at = b.properties.updated_at;
|
|
51
|
-
return a;
|
|
52
|
-
},
|
|
53
|
-
}, new golemio_validator_1.Validator(index_1.Gardens.name + "ModelValidator", index_1.Gardens.outputMongooseSchemaObject));
|
|
54
|
-
this.transformation = new _1.GardensTransformation();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.GardensWorker = GardensWorker;
|
|
58
|
-
//# sourceMappingURL=GardensWorker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GardensWorker.js","sourceRoot":"","sources":["../../src/integration-engine/GardensWorker.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mFAAwE;AACxE,yEAAsE;AACtE,mFAA2H;AAC3H,yEAA0E;AAC1E,2EAA2E;AAC3E,uDAAqC;AACrC,yBAA2C;AAE3C,MAAa,aAAc,SAAQ,oBAAU;IAKzC;QACI,KAAK,EAAE,CAAC;QAuCL,oBAAe,GAAG,CAAO,GAAQ,EAAiB,EAAE;YACvD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YAC5C,MAAM,eAAe,GAAG,MAAM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,KAAK,CAAC;gBACxC,CAAC,CAAC,UAAU,CAAC,WAAW,GAAG,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC;gBACpD,CAAC,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC;gBACpC,CAAC,CAAC,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC;gBAC5C,CAAC,CAAC,UAAU,CAAC,QAAQ,GAAG,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC;gBAC9C,CAAC,CAAC,UAAU,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC;gBAClD,CAAC,CAAC,UAAU,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC;gBAClD,OAAO,CAAC,CAAC;YACb,CAAC;SACJ,EACD,IAAI,6BAAS,CAAC,eAAO,CAAC,IAAI,GAAG,gBAAgB,EAAE,eAAO,CAAC,0BAA0B,CAAC,CACrF,CAAC;QACF,IAAI,CAAC,cAAc,GAAG,IAAI,wBAAqB,EAAE,CAAC;IACtD,CAAC;CAOJ;AAlDD,sCAkDC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.queueDefinitions = void 0;
|
|
4
|
-
const config_1 = require("@golemio/core/dist/integration-engine/config");
|
|
5
|
-
const index_1 = require("../schema-definitions/index");
|
|
6
|
-
const GardensWorker_1 = require("./GardensWorker");
|
|
7
|
-
const queueDefinitions = [
|
|
8
|
-
{
|
|
9
|
-
name: index_1.Gardens.name,
|
|
10
|
-
queuePrefix: config_1.config.RABBIT_EXCHANGE_NAME + "." + index_1.Gardens.name.toLowerCase(),
|
|
11
|
-
queues: [
|
|
12
|
-
{
|
|
13
|
-
name: "refreshDataInDB",
|
|
14
|
-
options: {
|
|
15
|
-
deadLetterExchange: config_1.config.RABBIT_EXCHANGE_NAME,
|
|
16
|
-
deadLetterRoutingKey: "dead",
|
|
17
|
-
messageTtl: 23 * 60 * 60 * 1000, // 23 hours
|
|
18
|
-
},
|
|
19
|
-
worker: GardensWorker_1.GardensWorker,
|
|
20
|
-
workerMethod: "refreshDataInDB",
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
},
|
|
24
|
-
];
|
|
25
|
-
exports.queueDefinitions = queueDefinitions;
|
|
26
|
-
//# sourceMappingURL=queueDefinitions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queueDefinitions.js","sourceRoot":"","sources":["../../src/integration-engine/queueDefinitions.ts"],"names":[],"mappings":";;;AAAA,yEAAsE;AAEtE,uDAAqC;AACrC,mDAAkD;AAElD,MAAM,gBAAgB,GAAuB;IACzC;QACI,IAAI,EAAE,eAAO,CAAC,IAAI;QAClB,WAAW,EAAE,eAAM,CAAC,oBAAoB,GAAG,GAAG,GAAG,eAAO,CAAC,IAAI,CAAC,WAAW,EAAE;QAC3E,MAAM,EAAE;YACJ;gBACI,IAAI,EAAE,iBAAiB;gBACvB,OAAO,EAAE;oBACL,kBAAkB,EAAE,eAAM,CAAC,oBAAoB;oBAC/C,oBAAoB,EAAE,MAAM;oBAC5B,UAAU,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,WAAW;iBAC/C;gBACD,MAAM,EAAE,6BAAa;gBACrB,YAAY,EAAE,iBAAiB;aAClC;SACJ;KACJ;CACJ,CAAC;AAEO,4CAAgB"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GardensModel = void 0;
|
|
4
|
-
const models_1 = require("@golemio/core/dist/output-gateway/models");
|
|
5
|
-
const index_1 = require("../schema-definitions/index");
|
|
6
|
-
class GardensModel extends models_1.GeoJsonModel {
|
|
7
|
-
/**
|
|
8
|
-
* Instantiates the model according to the given schema.
|
|
9
|
-
*/
|
|
10
|
-
constructor() {
|
|
11
|
-
super(index_1.Gardens.name, index_1.Gardens.outputMongooseSchemaObject, index_1.Gardens.mongoCollectionName);
|
|
12
|
-
// Set model-specific indexes
|
|
13
|
-
this.schema.index({ "properties.name": "text" });
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.GardensModel = GardensModel;
|
|
17
|
-
//# sourceMappingURL=GardensModel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GardensModel.js","sourceRoot":"","sources":["../../src/output-gateway/GardensModel.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,uDAAqC;AAErC,MAAa,YAAa,SAAQ,qBAAY;IAC1C;;OAEG;IACH;QACI,KAAK,CAAC,eAAO,CAAC,IAAI,EAAE,eAAO,CAAC,0BAA0B,EAAE,eAAO,CAAC,mBAAmB,CAAC,CAAC;QAErF,6BAA6B;QAC7B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC,CAAC;IACrD,CAAC;CACJ;AAVD,oCAUC"}
|