@golemio/fypr 1.7.2-dev.2584873493 → 1.7.2-dev.2602634331
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/db/example/00_clear_test_data.sql +3 -0
- package/db/example/06_information_panels_presets.sql +145 -0
- package/db/migrations/postgresql/20260601000000-add-information-panels-presets.js +53 -0
- package/db/migrations/postgresql/20260615000000-add-is-testing-to-agg-view.js +47 -0
- package/db/migrations/postgresql/sqls/20260601000000-add-information-panels-presets-down.sql +4 -0
- package/db/migrations/postgresql/sqls/20260601000000-add-information-panels-presets-up.sql +50 -0
- package/db/migrations/postgresql/sqls/20260615000000-add-is-testing-to-agg-view-down.sql +21 -0
- package/db/migrations/postgresql/sqls/20260615000000-add-is-testing-to-agg-view-up.sql +20 -0
- package/dist/integration-engine/ioc/Di.js +10 -2
- package/dist/integration-engine/ioc/Di.js.map +1 -1
- package/dist/integration-engine/ioc/FYPRIEContainerTokens.d.ts +4 -0
- package/dist/integration-engine/ioc/FYPRIEContainerTokens.js +6 -0
- package/dist/integration-engine/ioc/FYPRIEContainerTokens.js.map +1 -1
- package/dist/integration-engine/repositories/InformationPanelPresetsRepository.d.ts +17 -0
- package/dist/integration-engine/repositories/InformationPanelPresetsRepository.js +77 -0
- package/dist/integration-engine/repositories/InformationPanelPresetsRepository.js.map +1 -0
- package/dist/integration-engine/repositories/InformationPanelPresetsRoutesRepository.d.ts +13 -0
- package/dist/integration-engine/repositories/InformationPanelPresetsRoutesRepository.js +63 -0
- package/dist/integration-engine/repositories/InformationPanelPresetsRoutesRepository.js.map +1 -0
- package/dist/integration-engine/repositories/InformationPanelPresetsStopsRepository.d.ts +13 -0
- package/dist/integration-engine/repositories/InformationPanelPresetsStopsRepository.js +61 -0
- package/dist/integration-engine/repositories/InformationPanelPresetsStopsRepository.js.map +1 -0
- package/dist/integration-engine/workers/FYPRWorker.js +1 -0
- package/dist/integration-engine/workers/FYPRWorker.js.map +1 -1
- package/dist/integration-engine/workers/tasks/UpdatePresetsTask.d.ts +18 -0
- package/dist/integration-engine/workers/tasks/UpdatePresetsTask.js +103 -0
- package/dist/integration-engine/workers/tasks/UpdatePresetsTask.js.map +1 -0
- package/dist/output-gateway/fypr/controllers/v1/V1FyprElementKindsController.js +4 -2
- package/dist/output-gateway/fypr/controllers/v1/V1FyprElementKindsController.js.map +1 -1
- package/dist/output-gateway/fypr/data-access/FyprElementRepository.d.ts +6 -1
- package/dist/output-gateway/fypr/data-access/FyprElementRepository.js +26 -4
- package/dist/output-gateway/fypr/data-access/FyprElementRepository.js.map +1 -1
- package/dist/output-gateway/fypr/routers/v1/V1FyprElementKindsRouter.js +12 -1
- package/dist/output-gateway/fypr/routers/v1/V1FyprElementKindsRouter.js.map +1 -1
- package/dist/output-gateway/fypr/transformations/InformationPanelOutputTransformation.d.ts +3 -3
- package/dist/output-gateway/fypr/transformations/InformationPanelOutputTransformation.js +14 -5
- package/dist/output-gateway/fypr/transformations/InformationPanelOutputTransformation.js.map +1 -1
- package/dist/output-gateway/interfaces/IOGInformationPanel.d.ts +2 -1
- package/dist/output-gateway/interfaces/IOGInformationPanelScopes.d.ts +11 -0
- package/dist/output-gateway/interfaces/IOGInformationPanelScopes.js +3 -0
- package/dist/output-gateway/interfaces/IOGInformationPanelScopes.js.map +1 -0
- package/dist/output-gateway/ioc/Di.js +13 -9
- package/dist/output-gateway/ioc/Di.js.map +1 -1
- package/dist/schema-definitions/const.d.ts +1 -0
- package/dist/schema-definitions/const.js +2 -1
- package/dist/schema-definitions/const.js.map +1 -1
- package/dist/schema-definitions/data-sources/GolemioPresetsJSONSchema.d.ts +3 -0
- package/dist/schema-definitions/data-sources/GolemioPresetsJSONSchema.js +45 -0
- package/dist/schema-definitions/data-sources/GolemioPresetsJSONSchema.js.map +1 -0
- package/dist/schema-definitions/data-sources/interfaces/IGolemioPresetsResponse.d.ts +15 -0
- package/dist/schema-definitions/data-sources/interfaces/IGolemioPresetsResponse.js +3 -0
- package/dist/schema-definitions/data-sources/interfaces/IGolemioPresetsResponse.js.map +1 -0
- package/dist/schema-definitions/index.d.ts +8 -0
- package/dist/schema-definitions/index.js +10 -0
- package/dist/schema-definitions/index.js.map +1 -1
- package/dist/schema-definitions/models/InformationPanelPresetsModel.d.ts +16 -0
- package/dist/schema-definitions/models/InformationPanelPresetsModel.js +45 -0
- package/dist/schema-definitions/models/InformationPanelPresetsModel.js.map +1 -0
- package/dist/schema-definitions/models/InformationPanelPresetsRoutesAggModel.d.ts +11 -0
- package/dist/schema-definitions/models/InformationPanelPresetsRoutesAggModel.js +16 -0
- package/dist/schema-definitions/models/InformationPanelPresetsRoutesAggModel.js.map +1 -0
- package/dist/schema-definitions/models/InformationPanelPresetsRoutesModel.d.ts +15 -0
- package/dist/schema-definitions/models/InformationPanelPresetsRoutesModel.js +50 -0
- package/dist/schema-definitions/models/InformationPanelPresetsRoutesModel.js.map +1 -0
- package/dist/schema-definitions/models/InformationPanelPresetsStopsModel.d.ts +13 -0
- package/dist/schema-definitions/models/InformationPanelPresetsStopsModel.js +38 -0
- package/dist/schema-definitions/models/InformationPanelPresetsStopsModel.js.map +1 -0
- package/dist/schema-definitions/models/interfaces/IInformationPanelPreset.d.ts +7 -0
- package/dist/schema-definitions/models/interfaces/IInformationPanelPreset.js +3 -0
- package/dist/schema-definitions/models/interfaces/IInformationPanelPreset.js.map +1 -0
- package/dist/schema-definitions/models/interfaces/IInformationPanelPresetRoute.d.ts +6 -0
- package/dist/schema-definitions/models/interfaces/IInformationPanelPresetRoute.js +3 -0
- package/dist/schema-definitions/models/interfaces/IInformationPanelPresetRoute.js.map +1 -0
- package/dist/schema-definitions/models/interfaces/IInformationPanelPresetStop.d.ts +4 -0
- package/dist/schema-definitions/models/interfaces/IInformationPanelPresetStop.js +3 -0
- package/dist/schema-definitions/models/interfaces/IInformationPanelPresetStop.js.map +1 -0
- package/dist/schema-definitions/models/interfaces/IPresetRouteAgg.d.ts +5 -0
- package/dist/schema-definitions/models/interfaces/IPresetRouteAgg.js +3 -0
- package/dist/schema-definitions/models/interfaces/IPresetRouteAgg.js.map +1 -0
- package/docs/openapi-output.yaml +68 -0
- package/package.json +1 -1
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
INSERT INTO fypr.information_panels (
|
|
2
|
+
id,
|
|
3
|
+
document_id,
|
|
4
|
+
uid,
|
|
5
|
+
kind,
|
|
6
|
+
"name",
|
|
7
|
+
state,
|
|
8
|
+
"owner",
|
|
9
|
+
city_district,
|
|
10
|
+
lat,
|
|
11
|
+
lon,
|
|
12
|
+
map_link,
|
|
13
|
+
source_created_at,
|
|
14
|
+
source_updated_at,
|
|
15
|
+
source_published_at,
|
|
16
|
+
created_at,
|
|
17
|
+
updated_at,
|
|
18
|
+
stop_name,
|
|
19
|
+
stop_direction,
|
|
20
|
+
platform_code,
|
|
21
|
+
stop_type,
|
|
22
|
+
location_description,
|
|
23
|
+
preset,
|
|
24
|
+
data_source,
|
|
25
|
+
asw_stop_id,
|
|
26
|
+
construction_type,
|
|
27
|
+
panel_size,
|
|
28
|
+
jis_graphic
|
|
29
|
+
) VALUES (
|
|
30
|
+
'cfcdf084-bcf4-4507-9b7f-94d55d8acbec'::uuid,
|
|
31
|
+
'gqz8n7wg0wg8zvb83qppie62',
|
|
32
|
+
'021ddfad-234b-4c74-ba3a-fa879fe81e71',
|
|
33
|
+
'informační panel',
|
|
34
|
+
'Hradčanská B',
|
|
35
|
+
'Hotovo',
|
|
36
|
+
'HMP',
|
|
37
|
+
'Praha 6',
|
|
38
|
+
50.09725,
|
|
39
|
+
14.403991,
|
|
40
|
+
'https://mapy.com/cs/zakladni?x=14.403991&y=50.09725&z=15',
|
|
41
|
+
'2026-05-06 15:24:58.044',
|
|
42
|
+
'2026-05-06 15:24:58.044',
|
|
43
|
+
'2026-05-06 15:24:58.048',
|
|
44
|
+
'2026-05-06 16:00:09.072',
|
|
45
|
+
'2026-06-03 10:00:03.991',
|
|
46
|
+
'Hradčanská ',
|
|
47
|
+
'Vítězné náměstí',
|
|
48
|
+
'B',
|
|
49
|
+
'["tram"]'::jsonb,
|
|
50
|
+
'V přístřešku',
|
|
51
|
+
'thmp-hradcanska-b-8984',
|
|
52
|
+
'Golemio',
|
|
53
|
+
'thmp32',
|
|
54
|
+
'V přístřešku',
|
|
55
|
+
'v6',
|
|
56
|
+
true
|
|
57
|
+
), (
|
|
58
|
+
'eb92aede-2ec6-48d9-a7ef-865b774e1270'::uuid,
|
|
59
|
+
'ereopq3xwddwy3gczo3d314u',
|
|
60
|
+
'f464081d-1328-4589-b08d-75d310d80b72',
|
|
61
|
+
'informační panel',
|
|
62
|
+
'Nádraží Libeň hala',
|
|
63
|
+
'Hotovo',
|
|
64
|
+
'ROPID',
|
|
65
|
+
'Praha 8',
|
|
66
|
+
50.101235,
|
|
67
|
+
14.501999,
|
|
68
|
+
'https://mapy.com/cs/zakladni?x=14.501999&y=50.101235&z=15',
|
|
69
|
+
'2026-05-06 15:25:10.042',
|
|
70
|
+
'2026-05-06 15:25:10.042',
|
|
71
|
+
'2026-05-06 15:25:10.046',
|
|
72
|
+
'2026-05-06 16:00:09.072',
|
|
73
|
+
'2026-06-03 10:00:03.991',
|
|
74
|
+
'Nádraží Libeň hala',
|
|
75
|
+
NULL,
|
|
76
|
+
NULL,
|
|
77
|
+
'["Vlak"]'::jsonb,
|
|
78
|
+
'Na konstrukci - budova',
|
|
79
|
+
'gema-nadrazi_liben-autobusy gema-nadrazi_liben-tramvaje',
|
|
80
|
+
'Golemio',
|
|
81
|
+
NULL,
|
|
82
|
+
'Ostatní',
|
|
83
|
+
NULL,
|
|
84
|
+
true
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
INSERT INTO fypr.information_panels_presets (
|
|
88
|
+
id,
|
|
89
|
+
route_name,
|
|
90
|
+
note,
|
|
91
|
+
is_testing,
|
|
92
|
+
information_panel_document_id
|
|
93
|
+
) VALUES
|
|
94
|
+
('aaaaaaaa-0001-4000-8000-000000000001'::uuid, 'thmp-hradcanska-b-8984', 'LED v přístřešku Hradčanská B', false, 'gqz8n7wg0wg8zvb83qppie62'),
|
|
95
|
+
('aaaaaaaa-0002-4000-8000-000000000002'::uuid, 'gema-nadrazi_liben-autobusy', 'LCD v podchodu z nádraží', false, 'ereopq3xwddwy3gczo3d314u'),
|
|
96
|
+
('aaaaaaaa-0003-4000-8000-000000000003'::uuid, 'gema-nadrazi_liben-tramvaje', 'LCD v podchodu z nádraží', false, 'ereopq3xwddwy3gczo3d314u');
|
|
97
|
+
|
|
98
|
+
INSERT INTO fypr.information_panels_presets_stops (
|
|
99
|
+
preset_id,
|
|
100
|
+
stop_id
|
|
101
|
+
) VALUES
|
|
102
|
+
('aaaaaaaa-0001-4000-8000-000000000001'::uuid, 'U163Z2P'),
|
|
103
|
+
('aaaaaaaa-0002-4000-8000-000000000002'::uuid, 'U134Z4P'),
|
|
104
|
+
('aaaaaaaa-0002-4000-8000-000000000002'::uuid, 'U134Z5P'),
|
|
105
|
+
('aaaaaaaa-0003-4000-8000-000000000003'::uuid, 'U134Z1P'),
|
|
106
|
+
('aaaaaaaa-0003-4000-8000-000000000003'::uuid, 'U134Z2P');
|
|
107
|
+
|
|
108
|
+
INSERT INTO fypr.information_panels_presets_routes (
|
|
109
|
+
preset_id,
|
|
110
|
+
stop_id,
|
|
111
|
+
route_type,
|
|
112
|
+
route_short_name
|
|
113
|
+
) VALUES
|
|
114
|
+
('aaaaaaaa-0001-4000-8000-000000000001'::uuid, 'U163Z2P', 0, '1'),
|
|
115
|
+
('aaaaaaaa-0001-4000-8000-000000000001'::uuid, 'U163Z2P', 0, '18'),
|
|
116
|
+
('aaaaaaaa-0001-4000-8000-000000000001'::uuid, 'U163Z2P', 0, '2'),
|
|
117
|
+
('aaaaaaaa-0001-4000-8000-000000000001'::uuid, 'U163Z2P', 0, '20'),
|
|
118
|
+
('aaaaaaaa-0001-4000-8000-000000000001'::uuid, 'U163Z2P', 0, '22'),
|
|
119
|
+
('aaaaaaaa-0001-4000-8000-000000000001'::uuid, 'U163Z2P', 0, '23'),
|
|
120
|
+
('aaaaaaaa-0001-4000-8000-000000000001'::uuid, 'U163Z2P', 0, '25'),
|
|
121
|
+
('aaaaaaaa-0001-4000-8000-000000000001'::uuid, 'U163Z2P', 0, '26'),
|
|
122
|
+
('aaaaaaaa-0001-4000-8000-000000000001'::uuid, 'U163Z2P', 0, '8'),
|
|
123
|
+
('aaaaaaaa-0001-4000-8000-000000000001'::uuid, 'U163Z2P', 0, '91'),
|
|
124
|
+
('aaaaaaaa-0001-4000-8000-000000000001'::uuid, 'U163Z2P', 0, '96'),
|
|
125
|
+
('aaaaaaaa-0001-4000-8000-000000000001'::uuid, 'U163Z2P', 0, '97'),
|
|
126
|
+
('aaaaaaaa-0002-4000-8000-000000000002'::uuid, 'U134Z4P', 3, '136'),
|
|
127
|
+
('aaaaaaaa-0002-4000-8000-000000000002'::uuid, 'U134Z4P', 3, '177'),
|
|
128
|
+
('aaaaaaaa-0002-4000-8000-000000000002'::uuid, 'U134Z4P', 3, '182'),
|
|
129
|
+
('aaaaaaaa-0002-4000-8000-000000000002'::uuid, 'U134Z4P', 3, '183'),
|
|
130
|
+
('aaaaaaaa-0002-4000-8000-000000000002'::uuid, 'U134Z4P', 3, '195'),
|
|
131
|
+
('aaaaaaaa-0002-4000-8000-000000000002'::uuid, 'U134Z4P', 3, '913'),
|
|
132
|
+
('aaaaaaaa-0002-4000-8000-000000000002'::uuid, 'U134Z4P', 3, '914'),
|
|
133
|
+
('aaaaaaaa-0002-4000-8000-000000000002'::uuid, 'U134Z5P', 3, '136'),
|
|
134
|
+
('aaaaaaaa-0002-4000-8000-000000000002'::uuid, 'U134Z5P', 3, '177'),
|
|
135
|
+
('aaaaaaaa-0002-4000-8000-000000000002'::uuid, 'U134Z5P', 3, '182'),
|
|
136
|
+
('aaaaaaaa-0002-4000-8000-000000000002'::uuid, 'U134Z5P', 3, '183'),
|
|
137
|
+
('aaaaaaaa-0002-4000-8000-000000000002'::uuid, 'U134Z5P', 3, '195'),
|
|
138
|
+
('aaaaaaaa-0002-4000-8000-000000000002'::uuid, 'U134Z5P', 3, '913'),
|
|
139
|
+
('aaaaaaaa-0002-4000-8000-000000000002'::uuid, 'U134Z5P', 3, '914'),
|
|
140
|
+
('aaaaaaaa-0003-4000-8000-000000000003'::uuid, 'U134Z1P', 0, '16'),
|
|
141
|
+
('aaaaaaaa-0003-4000-8000-000000000003'::uuid, 'U134Z1P', 0, '8'),
|
|
142
|
+
('aaaaaaaa-0003-4000-8000-000000000003'::uuid, 'U134Z1P', 0, '94'),
|
|
143
|
+
('aaaaaaaa-0003-4000-8000-000000000003'::uuid, 'U134Z2P', 0, '16'),
|
|
144
|
+
('aaaaaaaa-0003-4000-8000-000000000003'::uuid, 'U134Z2P', 0, '8'),
|
|
145
|
+
('aaaaaaaa-0003-4000-8000-000000000003'::uuid, 'U134Z2P', 0, '94');
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var dbm;
|
|
4
|
+
var type;
|
|
5
|
+
var seed;
|
|
6
|
+
var fs = require('fs');
|
|
7
|
+
var path = require('path');
|
|
8
|
+
var Promise;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* We receive the dbmigrate dependency from dbmigrate initially.
|
|
12
|
+
* This enables us to not have to rely on NODE_PATH.
|
|
13
|
+
*/
|
|
14
|
+
exports.setup = function(options, seedLink) {
|
|
15
|
+
dbm = options.dbmigrate;
|
|
16
|
+
type = dbm.dataType;
|
|
17
|
+
seed = seedLink;
|
|
18
|
+
Promise = options.Promise;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.up = function(db) {
|
|
22
|
+
var filePath = path.join(__dirname, 'sqls', '20260601000000-add-information-panels-presets-up.sql');
|
|
23
|
+
return new Promise( function( resolve, reject ) {
|
|
24
|
+
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
|
|
25
|
+
if (err) return reject(err);
|
|
26
|
+
console.log('received data: ' + data);
|
|
27
|
+
|
|
28
|
+
resolve(data);
|
|
29
|
+
});
|
|
30
|
+
})
|
|
31
|
+
.then(function(data) {
|
|
32
|
+
return db.runSql(data);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.down = function(db) {
|
|
37
|
+
var filePath = path.join(__dirname, 'sqls', '20260601000000-add-information-panels-presets-down.sql');
|
|
38
|
+
return new Promise( function( resolve, reject ) {
|
|
39
|
+
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
|
|
40
|
+
if (err) return reject(err);
|
|
41
|
+
console.log('received data: ' + data);
|
|
42
|
+
|
|
43
|
+
resolve(data);
|
|
44
|
+
});
|
|
45
|
+
})
|
|
46
|
+
.then(function(data) {
|
|
47
|
+
return db.runSql(data);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports._meta = {
|
|
52
|
+
"version": 1
|
|
53
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var dbm;
|
|
4
|
+
var type;
|
|
5
|
+
var seed;
|
|
6
|
+
var fs = require('fs');
|
|
7
|
+
var path = require('path');
|
|
8
|
+
var Promise;
|
|
9
|
+
|
|
10
|
+
exports.setup = function(options, seedLink) {
|
|
11
|
+
dbm = options.dbmigrate;
|
|
12
|
+
type = dbm.dataType;
|
|
13
|
+
seed = seedLink;
|
|
14
|
+
Promise = options.Promise;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.up = function(db) {
|
|
18
|
+
var filePath = path.join(__dirname, 'sqls', '20260615000000-add-is-testing-to-agg-view-up.sql');
|
|
19
|
+
return new Promise( function( resolve, reject ) {
|
|
20
|
+
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
|
|
21
|
+
if (err) return reject(err);
|
|
22
|
+
console.log('received data: ' + data);
|
|
23
|
+
resolve(data);
|
|
24
|
+
});
|
|
25
|
+
})
|
|
26
|
+
.then(function(data) {
|
|
27
|
+
return db.runSql(data);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.down = function(db) {
|
|
32
|
+
var filePath = path.join(__dirname, 'sqls', '20260615000000-add-is-testing-to-agg-view-down.sql');
|
|
33
|
+
return new Promise( function( resolve, reject ) {
|
|
34
|
+
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
|
|
35
|
+
if (err) return reject(err);
|
|
36
|
+
console.log('received data: ' + data);
|
|
37
|
+
resolve(data);
|
|
38
|
+
});
|
|
39
|
+
})
|
|
40
|
+
.then(function(data) {
|
|
41
|
+
return db.runSql(data);
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
exports._meta = {
|
|
46
|
+
"version": 1
|
|
47
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
CREATE TABLE IF NOT EXISTS information_panels_presets (
|
|
2
|
+
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
|
|
3
|
+
route_name VARCHAR(100) NOT NULL UNIQUE,
|
|
4
|
+
note VARCHAR(1000) NOT NULL,
|
|
5
|
+
is_testing BOOLEAN NOT NULL,
|
|
6
|
+
information_panel_document_id VARCHAR(255) NULL REFERENCES information_panels(document_id) ON DELETE SET NULL,
|
|
7
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
8
|
+
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
CREATE INDEX IF NOT EXISTS idx_information_panels_presets_document_id
|
|
12
|
+
ON information_panels_presets(information_panel_document_id);
|
|
13
|
+
|
|
14
|
+
CREATE TABLE IF NOT EXISTS information_panels_presets_stops (
|
|
15
|
+
preset_id UUID NOT NULL REFERENCES information_panels_presets(id) ON DELETE CASCADE,
|
|
16
|
+
stop_id VARCHAR(50) NOT NULL,
|
|
17
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
18
|
+
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
19
|
+
PRIMARY KEY (preset_id, stop_id)
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
CREATE TABLE IF NOT EXISTS information_panels_presets_routes (
|
|
23
|
+
preset_id UUID NOT NULL REFERENCES information_panels_presets(id) ON DELETE CASCADE,
|
|
24
|
+
stop_id VARCHAR(50) NOT NULL,
|
|
25
|
+
route_type SMALLINT NOT NULL,
|
|
26
|
+
route_short_name VARCHAR(50) NOT NULL,
|
|
27
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
28
|
+
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
29
|
+
PRIMARY KEY (preset_id, stop_id, route_type, route_short_name)
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
CREATE OR REPLACE VIEW v_information_panels_presets_routes_agg AS
|
|
33
|
+
SELECT
|
|
34
|
+
p.information_panel_document_id,
|
|
35
|
+
p.route_name,
|
|
36
|
+
p.note,
|
|
37
|
+
COALESCE(
|
|
38
|
+
JSONB_AGG(
|
|
39
|
+
JSONB_BUILD_OBJECT(
|
|
40
|
+
'stop_id', r.stop_id,
|
|
41
|
+
'route_type', r.route_type,
|
|
42
|
+
'route_short_name', r.route_short_name
|
|
43
|
+
)
|
|
44
|
+
) FILTER (WHERE r.preset_id IS NOT NULL),
|
|
45
|
+
'[]'::jsonb
|
|
46
|
+
) AS routes
|
|
47
|
+
FROM information_panels_presets p
|
|
48
|
+
INNER JOIN information_panels ip ON ip.document_id = p.information_panel_document_id
|
|
49
|
+
LEFT JOIN information_panels_presets_routes r ON r.preset_id = p.id
|
|
50
|
+
GROUP BY p.id;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
DROP VIEW IF EXISTS v_information_panels_presets_routes_agg;
|
|
2
|
+
|
|
3
|
+
CREATE VIEW v_information_panels_presets_routes_agg AS
|
|
4
|
+
SELECT
|
|
5
|
+
p.information_panel_document_id,
|
|
6
|
+
p.route_name,
|
|
7
|
+
p.note,
|
|
8
|
+
COALESCE(
|
|
9
|
+
JSONB_AGG(
|
|
10
|
+
JSONB_BUILD_OBJECT(
|
|
11
|
+
'stop_id', r.stop_id,
|
|
12
|
+
'route_type', r.route_type,
|
|
13
|
+
'route_short_name', r.route_short_name
|
|
14
|
+
)
|
|
15
|
+
) FILTER (WHERE r.preset_id IS NOT NULL),
|
|
16
|
+
'[]'::jsonb
|
|
17
|
+
) AS routes
|
|
18
|
+
FROM information_panels_presets p
|
|
19
|
+
INNER JOIN information_panels ip ON ip.document_id = p.information_panel_document_id
|
|
20
|
+
LEFT JOIN information_panels_presets_routes r ON r.preset_id = p.id
|
|
21
|
+
GROUP BY p.id;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
CREATE OR REPLACE VIEW v_information_panels_presets_routes_agg AS
|
|
2
|
+
SELECT
|
|
3
|
+
p.information_panel_document_id,
|
|
4
|
+
p.route_name,
|
|
5
|
+
p.note,
|
|
6
|
+
COALESCE(
|
|
7
|
+
JSONB_AGG(
|
|
8
|
+
JSONB_BUILD_OBJECT(
|
|
9
|
+
'stop_id', r.stop_id,
|
|
10
|
+
'route_type', r.route_type,
|
|
11
|
+
'route_short_name', r.route_short_name
|
|
12
|
+
)
|
|
13
|
+
) FILTER (WHERE r.preset_id IS NOT NULL),
|
|
14
|
+
'[]'::jsonb
|
|
15
|
+
) AS routes,
|
|
16
|
+
p.is_testing
|
|
17
|
+
FROM information_panels_presets p
|
|
18
|
+
INNER JOIN information_panels ip ON ip.document_id = p.information_panel_document_id
|
|
19
|
+
LEFT JOIN information_panels_presets_routes r ON r.preset_id = p.id
|
|
20
|
+
GROUP BY p.id;
|
|
@@ -20,10 +20,14 @@ const UpdateTotemsTask_1 = require("../workers/tasks/UpdateTotemsTask");
|
|
|
20
20
|
const Di_1 = require("@golemio/core/dist/integration-engine/ioc/Di");
|
|
21
21
|
const FYPRIEContainerTokens_1 = require("./FYPRIEContainerTokens");
|
|
22
22
|
const DisplayCaseRepository_1 = require("../repositories/DisplayCaseRepository");
|
|
23
|
+
const InformationPanelPresetsRepository_1 = require("../repositories/InformationPanelPresetsRepository");
|
|
24
|
+
const InformationPanelPresetsRoutesRepository_1 = require("../repositories/InformationPanelPresetsRoutesRepository");
|
|
25
|
+
const InformationPanelPresetsStopsRepository_1 = require("../repositories/InformationPanelPresetsStopsRepository");
|
|
23
26
|
const InformationPanelRepository_1 = require("../repositories/InformationPanelRepository");
|
|
24
27
|
const ObeliskRepository_1 = require("../repositories/ObeliskRepository");
|
|
25
28
|
const SignpostRepository_1 = require("../repositories/SignpostRepository");
|
|
26
29
|
const TotemRepository_1 = require("../repositories/TotemRepository");
|
|
30
|
+
const UpdatePresetsTask_1 = require("../workers/tasks/UpdatePresetsTask");
|
|
27
31
|
//#region Initialization
|
|
28
32
|
exports.fyprIEContainer = Di_1.IntegrationEngineContainer.createChildContainer();
|
|
29
33
|
//#endregion
|
|
@@ -41,7 +45,10 @@ exports.fyprIEContainer
|
|
|
41
45
|
.registerSingleton(FYPRIEContainerTokens_1.fyprIEContainerTokens.InformationPanelRepository, InformationPanelRepository_1.InformationPanelRepository)
|
|
42
46
|
.registerSingleton(FYPRIEContainerTokens_1.fyprIEContainerTokens.ObeliskRepository, ObeliskRepository_1.ObeliskRepository)
|
|
43
47
|
.registerSingleton(FYPRIEContainerTokens_1.fyprIEContainerTokens.SignpostRepository, SignpostRepository_1.SignpostRepository)
|
|
44
|
-
.registerSingleton(FYPRIEContainerTokens_1.fyprIEContainerTokens.TotemRepository, TotemRepository_1.TotemRepository)
|
|
48
|
+
.registerSingleton(FYPRIEContainerTokens_1.fyprIEContainerTokens.TotemRepository, TotemRepository_1.TotemRepository)
|
|
49
|
+
.registerSingleton(FYPRIEContainerTokens_1.fyprIEContainerTokens.InformationPanelPresetsRepository, InformationPanelPresetsRepository_1.InformationPanelPresetsRepository)
|
|
50
|
+
.registerSingleton(FYPRIEContainerTokens_1.fyprIEContainerTokens.InformationPanelPresetsStopsRepository, InformationPanelPresetsStopsRepository_1.InformationPanelPresetsStopsRepository)
|
|
51
|
+
.registerSingleton(FYPRIEContainerTokens_1.fyprIEContainerTokens.InformationPanelPresetsRoutesRepository, InformationPanelPresetsRoutesRepository_1.InformationPanelPresetsRoutesRepository);
|
|
45
52
|
//#endregion
|
|
46
53
|
//#region Tasks
|
|
47
54
|
exports.fyprIEContainer
|
|
@@ -50,7 +57,8 @@ exports.fyprIEContainer
|
|
|
50
57
|
.registerSingleton(FYPRIEContainerTokens_1.fyprIEContainerTokens.UpdateInformationPanelsTask, UpdateInformationPanelsTask_1.UpdateInformationPanelsTask)
|
|
51
58
|
.registerSingleton(FYPRIEContainerTokens_1.fyprIEContainerTokens.UpdateObelisksTask, UpdateObelisksTask_1.UpdateObelisksTask)
|
|
52
59
|
.registerSingleton(FYPRIEContainerTokens_1.fyprIEContainerTokens.UpdateSignpostsTask, UpdateSignpostsTask_1.UpdateSignpostsTask)
|
|
53
|
-
.registerSingleton(FYPRIEContainerTokens_1.fyprIEContainerTokens.UpdateTotemsTask, UpdateTotemsTask_1.UpdateTotemsTask)
|
|
60
|
+
.registerSingleton(FYPRIEContainerTokens_1.fyprIEContainerTokens.UpdateTotemsTask, UpdateTotemsTask_1.UpdateTotemsTask)
|
|
61
|
+
.registerSingleton(FYPRIEContainerTokens_1.fyprIEContainerTokens.UpdatePresetsTask, UpdatePresetsTask_1.UpdatePresetsTask);
|
|
54
62
|
//#endregion
|
|
55
63
|
//#region Transformations
|
|
56
64
|
exports.fyprIEContainer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../src/integration-engine/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,6GAA2G;AAC3G,uHAAqH;AACrH,qGAAmG;AACnG,uGAAqG;AACrG,iGAA+F;AAC/F,8FAA4F;AAC5F,wGAAsG;AACtG,sFAAoF;AACpF,wFAAsF;AACtF,kFAAgF;AAChF,sEAAoE;AACpE,oFAAkF;AAClF,8FA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AAoB,EAAE,2CAAoB,CAAC,CAAC;AACzF,YAAY"}
|
|
@@ -9,12 +9,16 @@ export declare const fyprIEContainerTokens: {
|
|
|
9
9
|
ObeliskRepository: symbol;
|
|
10
10
|
SignpostRepository: symbol;
|
|
11
11
|
TotemRepository: symbol;
|
|
12
|
+
InformationPanelPresetsRepository: symbol;
|
|
13
|
+
InformationPanelPresetsStopsRepository: symbol;
|
|
14
|
+
InformationPanelPresetsRoutesRepository: symbol;
|
|
12
15
|
FetchDBFYPRTask: symbol;
|
|
13
16
|
UpdateDisplayCasesTask: symbol;
|
|
14
17
|
UpdateInformationPanelsTask: symbol;
|
|
15
18
|
UpdateObelisksTask: symbol;
|
|
16
19
|
UpdateSignpostsTask: symbol;
|
|
17
20
|
UpdateTotemsTask: symbol;
|
|
21
|
+
UpdatePresetsTask: symbol;
|
|
18
22
|
DisplayCasesTransformation: symbol;
|
|
19
23
|
InformationPanelsTransformation: symbol;
|
|
20
24
|
ObelisksTransformation: symbol;
|
|
@@ -16,6 +16,11 @@ exports.fyprIEContainerTokens = {
|
|
|
16
16
|
SignpostRepository: Symbol("SignpostRepository"),
|
|
17
17
|
TotemRepository: Symbol("TotemRepository"),
|
|
18
18
|
//#endregion
|
|
19
|
+
//#region Repositories (presets)
|
|
20
|
+
InformationPanelPresetsRepository: Symbol("InformationPanelPresetsRepository"),
|
|
21
|
+
InformationPanelPresetsStopsRepository: Symbol("InformationPanelPresetsStopsRepository"),
|
|
22
|
+
InformationPanelPresetsRoutesRepository: Symbol("InformationPanelPresetsRoutesRepository"),
|
|
23
|
+
//#endregion
|
|
19
24
|
//#region Tasks
|
|
20
25
|
FetchDBFYPRTask: Symbol("FetchDBFYPRTask"),
|
|
21
26
|
UpdateDisplayCasesTask: Symbol("UpdateDisplayCasesTask"),
|
|
@@ -23,6 +28,7 @@ exports.fyprIEContainerTokens = {
|
|
|
23
28
|
UpdateObelisksTask: Symbol("UpdateObelisksTask"),
|
|
24
29
|
UpdateSignpostsTask: Symbol("UpdateSignpostsTask"),
|
|
25
30
|
UpdateTotemsTask: Symbol("UpdateTotemsTask"),
|
|
31
|
+
UpdatePresetsTask: Symbol("UpdatePresetsTask"),
|
|
26
32
|
//#endregion
|
|
27
33
|
//#region Transformations
|
|
28
34
|
DisplayCasesTransformation: Symbol("DisplayCasesTransformation"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FYPRIEContainerTokens.js","sourceRoot":"","sources":["../../../src/integration-engine/ioc/FYPRIEContainerTokens.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAG;IACjC,sBAAsB;IACtB,mCAAmC,EAAE,MAAM,CAAC,qCAAqC,CAAC;IAClF,wCAAwC,EAAE,MAAM,CAAC,0CAA0C,CAAC;IAC5F,+BAA+B,EAAE,MAAM,CAAC,iCAAiC,CAAC;IAC1E,gCAAgC,EAAE,MAAM,CAAC,kCAAkC,CAAC;IAC5E,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,YAAY;IAEZ,sBAAsB;IACtB,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,iBAAiB,EAAE,MAAM,CAAC,mBAAmB,CAAC;IAC9C,kBAAkB,EAAE,MAAM,CAAC,oBAAoB,CAAC;IAChD,eAAe,EAAE,MAAM,CAAC,iBAAiB,CAAC;IAC1C,YAAY;IAEZ,eAAe;IACf,eAAe,EAAE,MAAM,CAAC,iBAAiB,CAAC;IAC1C,sBAAsB,EAAE,MAAM,CAAC,wBAAwB,CAAC;IACxD,2BAA2B,EAAE,MAAM,CAAC,6BAA6B,CAAC;IAClE,kBAAkB,EAAE,MAAM,CAAC,oBAAoB,CAAC;IAChD,mBAAmB,EAAE,MAAM,CAAC,qBAAqB,CAAC;IAClD,gBAAgB,EAAE,MAAM,CAAC,kBAAkB,CAAC;IAC5C,YAAY;IAEZ,yBAAyB;IACzB,0BAA0B,EAAE,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ClE,kBAAkB,EAAE,MAAM,CAAC,oBAAoB,CAAC;IAChD,mBAAmB,EAAE,MAAM,CAAC,qBAAqB,CAAC;IAClD,gBAAgB,EAAE,MAAM,CAAC,kBAAkB,CAAC;IAC5C,iBAAiB,EAAE,MAAM,CAAC,mBAAmB,CAAC;IAC9C,YAAY;IAEZ,yBAAyB;IACzB,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,+BAA+B,EAAE,MAAM,CAAC,iCAAiC,CAAC;IAC1E,sBAAsB,EAAE,MAAM,CAAC,wBAAwB,CAAC;IACxD,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC;IACpD,YAAY;CACf,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ILogger } from "@golemio/core/dist/helpers";
|
|
2
|
+
import { IDatabaseConnector } from "@golemio/core/dist/helpers/data-access/postgres/IDatabaseConnector";
|
|
3
|
+
import { AbstractValidatableRepository } from "@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractValidatableRepository";
|
|
4
|
+
import { JSONSchemaValidator } from "@golemio/core/dist/shared/golemio-validator";
|
|
5
|
+
import { IInformationPanelPreset } from "../../schema-definitions/models/interfaces/IInformationPanelPreset";
|
|
6
|
+
export declare class InformationPanelPresetsRepository extends AbstractValidatableRepository {
|
|
7
|
+
schema: string;
|
|
8
|
+
tableName: string;
|
|
9
|
+
validator: JSONSchemaValidator;
|
|
10
|
+
private sequelizeModel;
|
|
11
|
+
constructor(connector: IDatabaseConnector, log: ILogger);
|
|
12
|
+
/**
|
|
13
|
+
* Upserts presets and re-establishes panel links atomically — relink runs in the same transaction
|
|
14
|
+
* so the view never serves unlinked presets between the two writes.
|
|
15
|
+
*/
|
|
16
|
+
updateListAndRelink(data: Array<Omit<IInformationPanelPreset, "id">>): Promise<IInformationPanelPreset[]>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.InformationPanelPresetsRepository = void 0;
|
|
16
|
+
const AbstractValidatableRepository_1 = require("@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractValidatableRepository");
|
|
17
|
+
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
18
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
19
|
+
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
20
|
+
const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
|
|
21
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
22
|
+
const const_1 = require("../../schema-definitions/const");
|
|
23
|
+
const InformationPanelModel_1 = require("../../schema-definitions/models/InformationPanelModel");
|
|
24
|
+
const InformationPanelPresetsModel_1 = require("../../schema-definitions/models/InformationPanelPresetsModel");
|
|
25
|
+
let InformationPanelPresetsRepository = class InformationPanelPresetsRepository extends AbstractValidatableRepository_1.AbstractValidatableRepository {
|
|
26
|
+
constructor(connector, log) {
|
|
27
|
+
super(connector, log);
|
|
28
|
+
this.schema = const_1.PG_SCHEMA;
|
|
29
|
+
this.tableName = InformationPanelPresetsModel_1.InformationPanelPresetsModel.tableName;
|
|
30
|
+
this.validator = new golemio_validator_1.JSONSchemaValidator("InformationPanelPresetsRepository", InformationPanelPresetsModel_1.InformationPanelPresetsModel.jsonSchema);
|
|
31
|
+
this.sequelizeModel = connector
|
|
32
|
+
.getConnection()
|
|
33
|
+
.define(this.tableName, InformationPanelPresetsModel_1.InformationPanelPresetsModel.attributeModel, { schema: this.schema });
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Upserts presets and re-establishes panel links atomically — relink runs in the same transaction
|
|
37
|
+
* so the view never serves unlinked presets between the two writes.
|
|
38
|
+
*/
|
|
39
|
+
async updateListAndRelink(data) {
|
|
40
|
+
this.validator.Validate(data);
|
|
41
|
+
const transaction = await this.sequelizeModel.sequelize.transaction();
|
|
42
|
+
let rows;
|
|
43
|
+
try {
|
|
44
|
+
rows = await this.sequelizeModel.bulkCreate(data, {
|
|
45
|
+
updateOnDuplicate: InformationPanelPresetsModel_1.InformationPanelPresetsModel.getUpdateAttributes(),
|
|
46
|
+
transaction,
|
|
47
|
+
});
|
|
48
|
+
await this.sequelizeModel.destroy({
|
|
49
|
+
where: { updated_at: { [sequelize_1.Op.lt]: (0, sequelize_1.literal)(const_1.STALE_ROW_THRESHOLD) } },
|
|
50
|
+
transaction,
|
|
51
|
+
});
|
|
52
|
+
await this.connector.getConnection().query(`UPDATE ${const_1.PG_SCHEMA}.${InformationPanelPresetsModel_1.InformationPanelPresetsModel.tableName} AS p
|
|
53
|
+
SET information_panel_document_id = mapping.document_id, updated_at = now()
|
|
54
|
+
FROM (
|
|
55
|
+
SELECT ip.document_id, trim(preset_name) AS route_name
|
|
56
|
+
FROM ${const_1.PG_SCHEMA}.${InformationPanelModel_1.InformationPanelModel.tableName} AS ip,
|
|
57
|
+
regexp_split_to_table(ip.preset, '[\\s,]+') AS preset_name
|
|
58
|
+
WHERE ip.preset IS NOT NULL AND trim(preset_name) <> ''
|
|
59
|
+
) AS mapping
|
|
60
|
+
WHERE p.route_name = mapping.route_name`, { type: sequelize_1.QueryTypes.UPDATE, transaction });
|
|
61
|
+
await transaction.commit();
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
await transaction.rollback();
|
|
65
|
+
throw new golemio_errors_1.GeneralError("updateListAndRelink error", this.constructor.name, err);
|
|
66
|
+
}
|
|
67
|
+
return rows;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
exports.InformationPanelPresetsRepository = InformationPanelPresetsRepository;
|
|
71
|
+
exports.InformationPanelPresetsRepository = InformationPanelPresetsRepository = __decorate([
|
|
72
|
+
(0, tsyringe_1.injectable)(),
|
|
73
|
+
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.PostgresConnector)),
|
|
74
|
+
__param(1, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
|
|
75
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
76
|
+
], InformationPanelPresetsRepository);
|
|
77
|
+
//# sourceMappingURL=InformationPanelPresetsRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InformationPanelPresetsRepository.js","sourceRoot":"","sources":["../../../src/integration-engine/repositories/InformationPanelPresetsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,8IAA2I;AAC3I,wEAAqE;AACrE,6EAAwE;AACxE,mFAAkF;AAClF,mEAA2F;AAC3F,iEAAwE;AACxE,0DAA4D;AAC5D,iGAA0E;AAC1E,+GAAwF;AAIjF,IAAM,iCAAiC,GAAvC,MAAM,iCAAkC,SAAQ,6DAA6B;IAOhF,YAAiD,SAA6B,EAA4B,GAAY;QAClH,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAPnB,WAAM,GAAG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AAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,MAAM,WAAW,CAAC,QAAQ,EAAE,CAAC;YAC7B,MAAM,IAAI,6BAAY,CAAC,2BAA2B,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACpF,CAAC;QAED,OAAO,IAAiC,CAAC;IAC7C,CAAC;CACJ,CAAA;AAvDY,8EAAiC;4CAAjC,iCAAiC;IAD7C,IAAA,qBAAU,GAAE;IAQI,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,iBAAiB,CAAC,CAAA;IAAiC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;;GAPhG,iCAAiC,CAuD7C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ILogger } from "@golemio/core/dist/helpers";
|
|
2
|
+
import { IDatabaseConnector } from "@golemio/core/dist/helpers/data-access/postgres/IDatabaseConnector";
|
|
3
|
+
import { AbstractValidatableRepository } from "@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractValidatableRepository";
|
|
4
|
+
import { JSONSchemaValidator } from "@golemio/core/dist/shared/golemio-validator";
|
|
5
|
+
import { IInformationPanelPresetRoute } from "../../schema-definitions/models/interfaces/IInformationPanelPresetRoute";
|
|
6
|
+
export declare class InformationPanelPresetsRoutesRepository extends AbstractValidatableRepository {
|
|
7
|
+
schema: string;
|
|
8
|
+
tableName: string;
|
|
9
|
+
validator: JSONSchemaValidator;
|
|
10
|
+
private sequelizeModel;
|
|
11
|
+
constructor(connector: IDatabaseConnector, log: ILogger);
|
|
12
|
+
updateList(data: IInformationPanelPresetRoute[]): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.InformationPanelPresetsRoutesRepository = void 0;
|
|
16
|
+
const AbstractValidatableRepository_1 = require("@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractValidatableRepository");
|
|
17
|
+
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
18
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
19
|
+
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
20
|
+
const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
|
|
21
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
22
|
+
const const_1 = require("../../schema-definitions/const");
|
|
23
|
+
const InformationPanelPresetsRoutesModel_1 = require("../../schema-definitions/models/InformationPanelPresetsRoutesModel");
|
|
24
|
+
let InformationPanelPresetsRoutesRepository = class InformationPanelPresetsRoutesRepository extends AbstractValidatableRepository_1.AbstractValidatableRepository {
|
|
25
|
+
constructor(connector, log) {
|
|
26
|
+
super(connector, log);
|
|
27
|
+
this.schema = const_1.PG_SCHEMA;
|
|
28
|
+
this.tableName = InformationPanelPresetsRoutesModel_1.InformationPanelPresetsRoutesModel.tableName;
|
|
29
|
+
this.validator = new golemio_validator_1.JSONSchemaValidator("InformationPanelPresetsRoutesRepository", InformationPanelPresetsRoutesModel_1.InformationPanelPresetsRoutesModel.jsonSchema);
|
|
30
|
+
this.sequelizeModel = connector
|
|
31
|
+
.getConnection()
|
|
32
|
+
.define(this.tableName, InformationPanelPresetsRoutesModel_1.InformationPanelPresetsRoutesModel.attributeModel, { schema: this.schema });
|
|
33
|
+
}
|
|
34
|
+
async updateList(data) {
|
|
35
|
+
this.validator.Validate(data);
|
|
36
|
+
const seen = new Set();
|
|
37
|
+
const deduped = data.filter(({ preset_id, stop_id, route_type, route_short_name }) => seen.size !== seen.add(`${preset_id}|${stop_id}|${route_type}|${route_short_name}`).size);
|
|
38
|
+
const transaction = await this.sequelizeModel.sequelize.transaction();
|
|
39
|
+
try {
|
|
40
|
+
await this.sequelizeModel.bulkCreate(deduped, {
|
|
41
|
+
updateOnDuplicate: InformationPanelPresetsRoutesModel_1.InformationPanelPresetsRoutesModel.getUpdateAttributes(),
|
|
42
|
+
transaction,
|
|
43
|
+
});
|
|
44
|
+
await this.sequelizeModel.destroy({
|
|
45
|
+
where: { updated_at: { [sequelize_1.Op.lt]: (0, sequelize_1.literal)(const_1.STALE_ROW_THRESHOLD) } },
|
|
46
|
+
transaction,
|
|
47
|
+
});
|
|
48
|
+
await transaction.commit();
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
await transaction.rollback();
|
|
52
|
+
throw new golemio_errors_1.GeneralError("updateList error", this.constructor.name, err);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.InformationPanelPresetsRoutesRepository = InformationPanelPresetsRoutesRepository;
|
|
57
|
+
exports.InformationPanelPresetsRoutesRepository = InformationPanelPresetsRoutesRepository = __decorate([
|
|
58
|
+
(0, tsyringe_1.injectable)(),
|
|
59
|
+
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.PostgresConnector)),
|
|
60
|
+
__param(1, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
|
|
61
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
62
|
+
], InformationPanelPresetsRoutesRepository);
|
|
63
|
+
//# sourceMappingURL=InformationPanelPresetsRoutesRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InformationPanelPresetsRoutesRepository.js","sourceRoot":"","sources":["../../../src/integration-engine/repositories/InformationPanelPresetsRoutesRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,8IAA2I;AAC3I,wEAAqE;AACrE,6EAAwE;AACxE,mFAAkF;AAClF,mEAA+E;AAC/E,iEAAwE;AACxE,0DAA4D;AAC5D,2HAAoG;AAI7F,IAAM,uCAAuC,GAA7C,MAAM,uCAAwC,SAAQ,6DAA6B;IAOtF,YAAiD,SAA6B,EAA4B,GAAY;QAClH,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAPnB,WAAM,GAAG,iBAAS,CAAC;QACnB,cAAS,GAAG,uEAAkC,CAAC,SAAS,CAAC;QAO5D,IAAI,CAAC,SAAS,GAAG,IAAI,uCAAmB,CACpC,yCAAyC,EACzC,uEAAkC,CAAC,UAAU,CAChD,CAAC;QACF,IAAI,CAAC,cAAc,GAAG,SAAS;aAC1B,aAAa,EAAE;aACf,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,uEAAkC,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5G,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,IAAoC;QACxD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC9B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CACvB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,EAAE,EAAE,CACrD,I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