@golemio/waze-ccp 1.1.8 → 1.1.9-rc.1088929029

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.
Files changed (54) hide show
  1. package/db/example/.config.json +3 -0
  2. package/db/example/00_truncate_tables.sql +2 -0
  3. package/db/example/01_potholes_data.sql +11 -0
  4. package/db/migrations/postgresql/20231120134251-og-potholes-view.js +53 -0
  5. package/db/migrations/postgresql/sqls/20231120134251-og-potholes-view-down.sql +1 -0
  6. package/db/migrations/postgresql/sqls/20231120134251-og-potholes-view-up.sql +9 -0
  7. package/dist/integration-engine/WazeCCPIrregularitiesTransformation.js +3 -3
  8. package/dist/integration-engine/WazeCCPIrregularitiesTransformation.js.map +1 -1
  9. package/dist/integration-engine/WazeCCPJamsTransformation.js +3 -3
  10. package/dist/integration-engine/WazeCCPJamsTransformation.js.map +1 -1
  11. package/dist/output-gateway/controllers/PotholesController.d.ts +13 -0
  12. package/dist/output-gateway/controllers/PotholesController.js +71 -0
  13. package/dist/output-gateway/controllers/PotholesController.js.map +1 -0
  14. package/dist/output-gateway/domain/IPothole.d.ts +6 -0
  15. package/dist/output-gateway/domain/IPothole.js +3 -0
  16. package/dist/output-gateway/domain/IPothole.js.map +1 -0
  17. package/dist/output-gateway/domain/IPotholesController.d.ts +5 -0
  18. package/dist/output-gateway/domain/IPotholesController.js +3 -0
  19. package/dist/output-gateway/domain/IPotholesController.js.map +1 -0
  20. package/dist/output-gateway/domain/IPotholesOutputDto.d.ts +13 -0
  21. package/dist/output-gateway/domain/IPotholesOutputDto.js +3 -0
  22. package/dist/output-gateway/domain/IPotholesOutputDto.js.map +1 -0
  23. package/dist/output-gateway/domain/IPotholesParams.d.ts +6 -0
  24. package/dist/output-gateway/domain/IPotholesParams.js +3 -0
  25. package/dist/output-gateway/domain/IPotholesParams.js.map +1 -0
  26. package/dist/output-gateway/domain/IPotholesRepository.d.ts +6 -0
  27. package/dist/output-gateway/domain/IPotholesRepository.js +3 -0
  28. package/dist/output-gateway/domain/IPotholesRepository.js.map +1 -0
  29. package/dist/output-gateway/helpers/ParseDateTimeHelper.d.ts +6 -0
  30. package/dist/output-gateway/helpers/ParseDateTimeHelper.js +14 -0
  31. package/dist/output-gateway/helpers/ParseDateTimeHelper.js.map +1 -0
  32. package/dist/output-gateway/index.d.ts +2 -0
  33. package/dist/output-gateway/index.js +21 -0
  34. package/dist/output-gateway/index.js.map +1 -0
  35. package/dist/output-gateway/ioc/Di.d.ts +3 -0
  36. package/dist/output-gateway/ioc/Di.js +20 -0
  37. package/dist/output-gateway/ioc/Di.js.map +1 -0
  38. package/dist/output-gateway/ioc/ModuleContainerToken.d.ts +6 -0
  39. package/dist/output-gateway/ioc/ModuleContainerToken.js +10 -0
  40. package/dist/output-gateway/ioc/ModuleContainerToken.js.map +1 -0
  41. package/dist/output-gateway/repositories/PotholesRepository.d.ts +10 -0
  42. package/dist/output-gateway/repositories/PotholesRepository.js +102 -0
  43. package/dist/output-gateway/repositories/PotholesRepository.js.map +1 -0
  44. package/dist/output-gateway/repositories/models/PotholeModel.d.ts +21 -0
  45. package/dist/output-gateway/repositories/models/PotholeModel.js +10 -0
  46. package/dist/output-gateway/repositories/models/PotholeModel.js.map +1 -0
  47. package/dist/output-gateway/routers/PotHolesRouter.d.ts +8 -0
  48. package/dist/output-gateway/routers/PotHolesRouter.js +36 -0
  49. package/dist/output-gateway/routers/PotHolesRouter.js.map +1 -0
  50. package/dist/output-gateway/transformation/PotholesDtoTransformation.d.ts +7 -0
  51. package/dist/output-gateway/transformation/PotholesDtoTransformation.js +39 -0
  52. package/dist/output-gateway/transformation/PotholesDtoTransformation.js.map +1 -0
  53. package/docs/openapi-output.yaml +153 -0
  54. package/package.json +8 -1
@@ -0,0 +1,3 @@
1
+ {
2
+ "schema": "waze_ccp"
3
+ }
@@ -0,0 +1,2 @@
1
+ TRUNCATE wazeccp_alerts;
2
+
@@ -0,0 +1,11 @@
1
+ INSERT INTO wazeccp_alerts (id,uuid,pub_millis,pub_utc_date,road_type,"location",street,city,country,magvar,reliability,report_description,report_rating,confidence,"type",subtype,report_by_municipality_user,thumbs_up,jam_uuid,valid_from,downloaded_at,duplicate_count,create_batch_id,created_at,created_by,update_batch_id,updated_at,updated_by) VALUES
2
+ ('c1029d8c-c24b-6d1a-4328-a93724f2ad4f','60155213-bec9-4551-a264-d9cfd3cdebaa',1700494132000,'2023-11-20 15:28:52',2,'{"x": 14.469014, "y": 50.092079}','Pod Krejcárkem','Praha','EZ',238,5,NULL,0,0,'HAZARD','HAZARD_ON_ROAD_POT_HOLE',false,NULL,NULL,'2023-11-20 16:30:07.739+01','2023-11-20 16:56:04.464+01',13,NULL,'2023-11-20 16:30:43.645+01',NULL,NULL,'2023-11-20 16:56:36.942+01',NULL),
3
+ ('3dc091c2-2c7f-664a-11e8-8a0d512f9148','93a4dbf5-4f91-4df2-a41b-09cbd0881885',1700458700000,'2023-11-20 05:38:20',1,'{"x": 14.13676, "y": 49.986693}','Na Skalce','Vráž','EZ',359,6,NULL,5,0,'HAZARD','HAZARD_ON_ROAD_POT_HOLE',false,NULL,NULL,'2023-11-20 11:48:04.804+01','2023-11-20 14:38:03.562+01',84,NULL,'2023-11-20 11:48:07.308+01',NULL,NULL,'2023-11-20 14:38:18.433+01',NULL),
4
+ ('f4af12ef-e65b-c693-f6b8-ca4b408275fc','d542facf-c7d7-4100-b19c-dde0fd464a8c',1700492166000,'2023-11-20 14:56:06',1,'{"x": 14.516557, "y": 49.972562}','Plavecká','Jesenice','EZ',48,5,NULL,2,0,'HAZARD','HAZARD_ON_ROAD_POT_HOLE',false,NULL,NULL,'2023-11-20 15:58:03.001+01','2023-11-20 23:56:03.113+01',239,NULL,'2023-11-20 15:58:18.65+01',NULL,NULL,'2023-11-20 23:56:12.925+01',NULL),
5
+ ('766b8da5-2c25-5612-a390-8845171ca915','58a341c9-925b-48d8-a7d9-0c29fb1f5139',1700494078000,'2023-11-20 15:27:58',7,'{"x": 14.537883, "y": 50.079122}','Průmyslová','Praha','EZ',182,5,NULL,1,0,'HAZARD','HAZARD_ON_ROAD_POT_HOLE',false,NULL,NULL,'2023-11-20 16:28:03.2+01','2023-11-20 16:34:03.007+01',3,NULL,'2023-11-20 16:28:32.888+01',NULL,NULL,'2023-11-20 16:34:35.104+01',NULL),
6
+ ('2f8b09c1-cc4b-9f9b-4754-cfa1f8369cd0','c9f81712-5ff2-4608-9224-2c06717bfa40',1700479399000,'2023-11-20 11:23:19',2,'{"x": 14.498919, "y": 50.118421}','Prosecká','Praha','EZ',231,5,NULL,4,0,'HAZARD','HAZARD_ON_ROAD_POT_HOLE',false,NULL,NULL,'2023-11-20 12:24:03.45+01','2023-11-20 13:00:07.491+01',18,NULL,'2023-11-20 12:24:21.145+01',NULL,NULL,'2023-11-20 13:00:25.614+01',NULL),
7
+ ('8a3efbe3-e3b2-f08e-d6b2-15c2124d06d7','5bc70724-a331-45dd-8104-62ca0e691fd7',1700490064000,'2023-11-20 14:21:04',2,'{"x": 14.459653, "y": 50.075054}','Benešovská','Praha','EZ',108,5,NULL,3,0,'HAZARD','HAZARD_ON_ROAD_POT_HOLE',false,NULL,NULL,'2023-11-20 15:22:03.727+01','2023-11-20 15:42:03.862+01',10,NULL,'2023-11-20 15:22:10.901+01',NULL,NULL,'2023-11-20 15:42:12.063+01',NULL),
8
+ ('3048b39b-63b3-942a-b0fe-ea70bf684247','8693f215-0d32-4e98-87ca-82db7f8206bf',1700490985000,'2023-11-20 14:36:25',2,'{"x": 14.489722, "y": 50.054264}','V korytech','Praha','EZ',53,5,NULL,2,0,'HAZARD','HAZARD_ON_ROAD_POT_HOLE',false,NULL,NULL,'2023-11-20 15:38:04.105+01','2023-11-20 17:34:02.866+01',58,NULL,'2023-11-20 15:38:14.469+01',NULL,NULL,'2023-11-20 17:34:11.599+01',NULL),
9
+ ('17dea4e1-f533-496f-33b9-9761b7bf978b','64f17885-3a3a-466d-9d56-af1290896f52',1700463953000,'2023-11-20 07:05:53',1,'{"x": 14.433417, "y": 50.041907}','Hudečkova','Praha','EZ',41,6,NULL,5,0,'HAZARD','HAZARD_ON_ROAD_POT_HOLE',false,NULL,NULL,'2023-11-20 11:48:04.804+01','2023-11-20 16:06:03.874+01',128,NULL,'2023-11-20 11:48:05.409+01',NULL,NULL,'2023-11-20 16:06:11.677+01',NULL),
10
+ ('0f3031d1-e706-3993-420e-26fbbd5bb6f9','fb1039cc-b43f-4bca-881d-7b2048cc1a95',1700482750000,'2023-11-20 12:19:10',6,'{"x": 14.499297, "y": 50.131586}','Kbelská','Praha','EZ',318,5,NULL,4,0,'HAZARD','HAZARD_ON_ROAD_POT_HOLE',false,NULL,NULL,'2023-11-20 13:20:04.987+01','2023-11-20 13:46:03.705+01',13,NULL,'2023-11-20 13:20:15.779+01',NULL,NULL,'2023-11-20 13:46:12.141+01',NULL),
11
+ ('e0f2b6fc-9f77-0a12-f64b-a2e03258d990','6b67db2c-7a9e-48a2-86fd-a860b67ca94b',1700476845000,'2023-11-20 10:40:45',7,'{"x": 14.341796, "y": 50.094819}','Evropská','Praha','EZ',74,10,NULL,4,5,'HAZARD','HAZARD_ON_ROAD_POT_HOLE',false,NULL,NULL,'2023-11-20 11:48:04.804+01','2023-11-20 11:52:07.77+01',2,NULL,'2023-11-20 11:48:15.281+01',NULL,NULL,'2023-11-20 11:52:35.562+01',NULL);
@@ -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', '20231120134251-og-potholes-view-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', '20231120134251-og-potholes-view-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 @@
1
+ drop view v_waze_potholes_v2;
@@ -0,0 +1,9 @@
1
+ CREATE VIEW v_waze_potholes_v2
2
+ as select
3
+ wa.*,
4
+ wr.name as road_type_name,
5
+ timezone('UTC',pub_utc_date) AS published_at,
6
+ downloaded_at AS last_reported
7
+ from wazeccp_alerts wa
8
+ left join wazeccp_roads wr on
9
+ wa.road_type = wr.id
@@ -10,10 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.WazeCCPIrregularitiesTransformation = void 0;
13
+ const index_1 = require("../schema-definitions/index");
13
14
  const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
14
15
  const transformations_1 = require("@golemio/core/dist/integration-engine/transformations");
15
- const index_1 = require("../schema-definitions/index");
16
- const _1 = require("./");
16
+ const WazeCCPUtils_1 = require("./WazeCCPUtils");
17
17
  class WazeCCPIrregularitiesTransformation extends transformations_1.BaseTransformation {
18
18
  constructor() {
19
19
  super();
@@ -42,7 +42,7 @@ class WazeCCPIrregularitiesTransformation extends transformations_1.BaseTransfor
42
42
  delete irregularity.rootStart;
43
43
  const downloadedAt = irregularity.downloadedAt;
44
44
  delete irregularity.downloadedAt;
45
- const irregularityHash = (0, _1.generateAJIUniqueIdentifierHash)(irregularity, rootStart);
45
+ const irregularityHash = (0, WazeCCPUtils_1.generateAJIUniqueIdentifierHash)(irregularity, rootStart);
46
46
  const res = {
47
47
  alerts_count: irregularity.alertsCount,
48
48
  cause_type: irregularity.causeType,
@@ -1 +1 @@
1
- {"version":3,"file":"WazeCCPIrregularitiesTransformation.js","sourceRoot":"","sources":["../../src/integration-engine/WazeCCPIrregularitiesTransformation.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2EAAoE;AACpE,2FAA4G;AAC5G,uDAAqC;AACrC,yBAAqD;AAErD,MAAa,mCAAoC,SAAQ,oCAAkB;IAGvE;QACI,KAAK,EAAE,CAAC;QAIZ;;WAEG;QACI,cAAS,GAAG,CAAO,IAAiB,EAAwB,EAAE;YACjE,MAAM,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC;YACvC,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;YAEvC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;gBACtB,aAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,oCAAoC,CAAC,CAAC;gBAC3D,OAAO,EAAE,CAAC;aACb;YAED,MAAM,OAAO,GAAU,EAAE,CAAC;YAC1B,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,OAAY,EAAE,EAAE;gBACzC,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,iCAC1B,OAAO,KACV,YAAY;oBACZ,SAAS,IACX,CAAC;gBACH,IAAI,GAAG,EAAE;oBACL,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;iBACrB;YACL,CAAC,CAAC,CAAC;YACH,OAAO,OAAO,CAAC;QACnB,CAAC,CAAA,CAAC;QAEQ,qBAAgB,GAAG,CAAC,YAAiB,EAAO,EAAE;YACpD,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC;YACzC,OAAO,YAA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YAAY,CAAC,IAAI;gBACvB,WAAW,EAAE,YAAY,CAAC,UAAU;gBACpC,kBAAkB,EAAE,YAAY,CAAC,gBAAgB;gBACjD,eAAe,EAAE,IAAI,IAAI,CAAC,CAAC,YAAY,CAAC,gBAAgB,CAAC;gBACzD,IAAI,EAAE,YAAY,CAAC,EAAE;aACxB,CAAC;YAEF,OAAO,GAAG,CAAC;QACf,CAAC,CAAC;QAvEE,IAAI,CAAC,IAAI,GAAG,eAAO,CAAC,cAAc,CAAC,IAAI,CAAC;IAC5C,CAAC;CAuEJ;AA7ED,kFA6EC"}
1
+ {"version":3,"file":"WazeCCPIrregularitiesTransformation.js","sourceRoot":"","sources":["../../src/integration-engine/WazeCCPIrregularitiesTransformation.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAqC;AACrC,2EAAoE;AACpE,2FAA4G;AAC5G,iDAAiE;AAEjE,MAAa,mCAAoC,SAAQ,oCAAkB;IAGvE;QACI,KAAK,EAAE,CAAC;QAIZ;;WAEG;QACI,cAAS,GAAG,CAAO,IAAiB,EAAwB,EAAE;YACjE,MAAM,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC;YACvC,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;YAEvC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;gBACtB,aAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,oCAAoC,CAAC,CAAC;gBAC3D,OAAO,EAAE,CAAC;aACb;YAED,MAAM,OAAO,GAAU,EAAE,CAAC;YAC1B,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,OAAY,EAAE,EAAE;gBACzC,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,iCAC1B,OAAO,KACV,YAAY;oBACZ,SAAS,IACX,CAAC;gBACH,IAAI,GAAG,EAAE;oBACL,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;iBACrB;YACL,CAAC,CAAC,CAAC;YACH,OAAO,OAAO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AC,KAAK;gBACzB,UAAU,EAAE,YAAY,CAAC,SAAS;gBAClC,MAAM,EAAE,YAAY,CAAC,MAAM;gBAC3B,KAAK,EAAE,YAAY,CAAC,KAAK;gBACzB,IAAI,EAAE,YAAY,CAAC,IAAI;gBACvB,WAAW,EAAE,YAAY,CAAC,UAAU;gBACpC,kBAAkB,EAAE,YAAY,CAAC,gBAAgB;gBACjD,eAAe,EAAE,IAAI,IAAI,CAAC,CAAC,YAAY,CAAC,gBAAgB,CAAC;gBACzD,IAAI,EAAE,YAAY,CAAC,EAAE;aACxB,CAAC;YAEF,OAAO,GAAG,CAAC;QACf,CAAC,CAAC;QAvEE,IAAI,CAAC,IAAI,GAAG,eAAO,CAAC,cAAc,CAAC,IAAI,CAAC;IAC5C,CAAC;CAuEJ;AA7ED,kFA6EC"}
@@ -10,10 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.WazeCCPJamsTransformation = void 0;
13
+ const index_1 = require("../schema-definitions/index");
13
14
  const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
14
15
  const transformations_1 = require("@golemio/core/dist/integration-engine/transformations");
15
- const index_1 = require("../schema-definitions/index");
16
- const _1 = require("./");
16
+ const WazeCCPUtils_1 = require("./WazeCCPUtils");
17
17
  class WazeCCPJamsTransformation extends transformations_1.BaseTransformation {
18
18
  constructor() {
19
19
  super();
@@ -42,7 +42,7 @@ class WazeCCPJamsTransformation extends transformations_1.BaseTransformation {
42
42
  delete jam.rootStart;
43
43
  const downloadedAt = jam.downloadedAt;
44
44
  delete jam.downloadedAt;
45
- const jamHash = (0, _1.generateAJIUniqueIdentifierHash)(jam, rootStart);
45
+ const jamHash = (0, WazeCCPUtils_1.generateAJIUniqueIdentifierHash)(jam, rootStart);
46
46
  const res = {
47
47
  blocking_alert_id: jam.blockingAlertUuid,
48
48
  city: jam.city,
@@ -1 +1 @@
1
- {"version":3,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B;gBACxC,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,OAAO,EAAE,GAAG,CAAC,OAAO;gBACpB,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,aAAa,EAAE,YAAY;gBAC3B,QAAQ,EAAE,GAAG,CAAC,OAAO;gBACrB,EAAE,EAAE,OAAO;gBACX,MAAM,EAAE,GAAG,CAAC,MAAM;gBAClB,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,UAAU,EAAE,GAAG,CAAC,SAAS;gBACzB,YAAY,EAAE,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC;gBACtC,SAAS,EAAE,GAAG,CAAC,QAAQ;gBACvB,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,SAAS,EAAE,GAAG,CAAC,QAAQ;gBACvB,UAAU,EAAE,GAAG,CAAC,SAAS;gBACzB,MAAM,EAAE,GAAG,CAAC,MAAM;gBAClB,SAAS,EAAE,GAAG,CAAC,QAAQ;gBACvB,SAAS,EAAE,GAAG,CAAC,QAAQ;gBACvB,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,IAAI,EAAE,GAAG,CAAC,IAAI;aACjB,CAAC;YAEF,OAAO,GAAG,CAAC;QACf,CAAC,CAAC;QA7DE,IAAI,CAAC,IAAI,GAAG,eAAO,CAAC,IAAI,CAAC,IAAI,CAAC;IAClC,CAAC;CA6DJ;AAnED,8DAmEC"}
1
+ {"version":3,"file":"WazeCCPJamsTransformation.js","sourceRoot":"","sources":["../../src/integration-engine/WazeCCPJamsTransformation.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAqC;AACrC,2EAAoE;AACpE,2FAA4G;AAC5G,iDAAiE;AAEjE,MAAa,yBAA0B,SAAQ,oCAAkB;IAG7D;QACI,KAAK,EAAE,CAAC;QAIZ;;WAEG;QACI,cAAS,GAAG,CAAO,IAAiB,EAAwB,EAAE;YACjE,MAAM,SAAS,GAA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AC,IAAI;gBACd,UAAU,EAAE,GAAG,CAAC,SAAS;gBACzB,YAAY,EAAE,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC;gBACtC,SAAS,EAAE,GAAG,CAAC,QAAQ;gBACvB,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,SAAS,EAAE,GAAG,CAAC,QAAQ;gBACvB,UAAU,EAAE,GAAG,CAAC,SAAS;gBACzB,MAAM,EAAE,GAAG,CAAC,MAAM;gBAClB,SAAS,EAAE,GAAG,CAAC,QAAQ;gBACvB,SAAS,EAAE,GAAG,CAAC,QAAQ;gBACvB,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,IAAI,EAAE,GAAG,CAAC,IAAI;aACjB,CAAC;YAEF,OAAO,GAAG,CAAC;QACf,CAAC,CAAC;QA7DE,IAAI,CAAC,IAAI,GAAG,eAAO,CAAC,IAAI,CAAC,IAAI,CAAC;IAClC,CAAC;CA6DJ;AAnED,8DAmEC"}
@@ -0,0 +1,13 @@
1
+ import { IPotholesController } from "../domain/IPotholesController";
2
+ import { IPotholesRepository } from "../domain/IPotholesRepository";
3
+ import { IAlertDto } from "../../schema-definitions/interfaces/IAlertDto";
4
+ import { AbstractTransformation } from "@golemio/core/dist/helpers/transformation/AbstractTransformation";
5
+ import { IGeoJSONFeature } from "@golemio/core/dist/output-gateway";
6
+ import { NextFunction, Request, Response } from "@golemio/core/dist/shared/express";
7
+ export declare class PotholesController implements IPotholesController {
8
+ private repository;
9
+ private transformation;
10
+ constructor(repository: IPotholesRepository, transformation: AbstractTransformation<IAlertDto, IGeoJSONFeature>);
11
+ getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
12
+ private parseParams;
13
+ }
@@ -0,0 +1,71 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ var PotholesController_1;
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.PotholesController = void 0;
26
+ const ModuleContainerToken_1 = require("../ioc/ModuleContainerToken");
27
+ const DateTime_1 = require("@golemio/core/dist/helpers/DateTime");
28
+ const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation");
29
+ const output_gateway_1 = require("@golemio/core/dist/output-gateway");
30
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
31
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
32
+ let PotholesController = exports.PotholesController = PotholesController_1 = class PotholesController {
33
+ constructor(repository, transformation) {
34
+ this.repository = repository;
35
+ this.transformation = transformation;
36
+ this.getAll = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
37
+ try {
38
+ const params = yield this.parseParams(req);
39
+ const result = yield this.repository.GetAll(params);
40
+ const transformedResult = (0, output_gateway_1.buildGeojsonFeatureCollection)(this.transformation.transformArray(result));
41
+ res.json(transformedResult);
42
+ }
43
+ catch (err) {
44
+ next(err);
45
+ }
46
+ });
47
+ }
48
+ parseParams(req) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ try {
51
+ const result = {
52
+ limit: req.query.limit ? Number(req.query.limit) : undefined,
53
+ offset: req.query.offset ? Number(req.query.offset) : undefined,
54
+ dateFrom: req.query.from ? req.query.from : (0, DateTime_1.dateTime)(new Date()).subtract(7, "days").toISOString(),
55
+ dateTo: req.query.to ? req.query.to : new Date().toISOString(),
56
+ };
57
+ return result;
58
+ }
59
+ catch (error) {
60
+ throw new golemio_errors_1.GeneralError("Param parsing error", PotholesController_1.name, error, 500);
61
+ }
62
+ });
63
+ }
64
+ };
65
+ exports.PotholesController = PotholesController = PotholesController_1 = __decorate([
66
+ (0, tsyringe_1.injectable)(),
67
+ __param(0, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.PotholesRepository)),
68
+ __param(1, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.PotholesTransformation)),
69
+ __metadata("design:paramtypes", [Object, AbstractTransformation_1.AbstractTransformation])
70
+ ], PotholesController);
71
+ //# sourceMappingURL=PotholesController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PotholesController.js","sourceRoot":"","sources":["../../../src/output-gateway/controllers/PotholesController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,sEAAoE;AAEpE,kEAA+D;AAC/D,6GAA0G;AAC1G,sEAAmG;AAEnG,6EAAwE;AACxE,iEAAwE;AAGjE,IAAM,kBAAkB,uDAAxB,MAAM,kBAAkB;IAC3B,YACqD,UAAuC,EAExF,cAA0E;QAFjB,eAAU,GAAV,UAAU,CAAqB;QAEhF,mBAAc,GAAd,cAAc,CAAoD;QAGvE,WAAM,GAAG,CAAO,GAAY,EAAE,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ACjB;YAAC,OAAO,KAAK,EAAE;gBACZ,MAAM,IAAI,6BAAY,CAAC,qBAAqB,EAAE,oBAAkB,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;aACtF;QACL,CAAC;KAAA;CACJ,CAAA;6BAlCY,kBAAkB;IAD9B,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,kBAAkB,CAAC,CAAA;IAC/C,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,sBAAsB,CAAC,CAAA;6CAC5B,+CAAsB;GAJzC,kBAAkB,CAkC9B"}
@@ -0,0 +1,6 @@
1
+ import { IAlertDto } from "../../schema-definitions/interfaces/IAlertDto";
2
+ export interface IPothole extends IAlertDto {
3
+ road_type_name: string | null;
4
+ published_at: Date;
5
+ last_reported: Date;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IPothole.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPothole.js","sourceRoot":"","sources":["../../../src/output-gateway/domain/IPothole.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /// <reference types="express" />
2
+ import { NextFunction, Request, Response } from "@golemio/core/dist/shared/express";
3
+ export interface IPotholesController {
4
+ getAll(req: Request, res: Response, next: NextFunction): Promise<void>;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IPotholesController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPotholesController.js","sourceRoot":"","sources":["../../../src/output-gateway/domain/IPotholesController.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ export interface IPotholesOutputDto {
2
+ uuid: string;
3
+ city: string | null;
4
+ street: string | null;
5
+ road_type: string | null;
6
+ event_direction: number | null;
7
+ published_at: Date;
8
+ valid_from: Date;
9
+ last_reported_at: Date;
10
+ reliability: number | null;
11
+ confidence: number | null;
12
+ duplicate_count: number | null;
13
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IPotholesOutputDto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPotholesOutputDto.js","sourceRoot":"","sources":["../../../src/output-gateway/domain/IPotholesOutputDto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export interface IPotholesParams {
2
+ limit: number;
3
+ offset: number;
4
+ dateFrom: string;
5
+ dateTo: string;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IPotholesParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPotholesParams.js","sourceRoot":"","sources":["../../../src/output-gateway/domain/IPotholesParams.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { IAlertDto } from "../../schema-definitions/interfaces/IAlertDto";
2
+ import { IPotholesParams } from "./IPotholesParams";
3
+ export interface IPotholesRepository {
4
+ GetAll(params: Partial<IPotholesParams>): Promise<IAlertDto[]>;
5
+ GetOne(id: string): Promise<IAlertDto>;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IPotholesRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPotholesRepository.js","sourceRoot":"","sources":["../../../src/output-gateway/domain/IPotholesRepository.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export declare class ParseDateTimeHelper {
2
+ static getDateTimeSeparately(datetime: Date): {
3
+ date: string;
4
+ time: string;
5
+ };
6
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ParseDateTimeHelper = void 0;
4
+ const DateTime_1 = require("@golemio/core/dist/helpers/DateTime");
5
+ class ParseDateTimeHelper {
6
+ static getDateTimeSeparately(datetime) {
7
+ const wrappedDate = (0, DateTime_1.dateTime)(datetime, { timeZone: "Europe/Prague" });
8
+ const date = wrappedDate.format("yyyy-LL-dd");
9
+ const time = wrappedDate.format("HH:mm:ss");
10
+ return { date, time };
11
+ }
12
+ }
13
+ exports.ParseDateTimeHelper = ParseDateTimeHelper;
14
+ //# sourceMappingURL=ParseDateTimeHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ParseDateTimeHelper.js","sourceRoot":"","sources":["../../../src/output-gateway/helpers/ParseDateTimeHelper.ts"],"names":[],"mappings":";;;AAAA,kEAA+D;AAE/D,MAAa,mBAAmB;IACrB,MAAM,CAAC,qBAAqB,CAAC,QAAc;QAC9C,MAAM,WAAW,GAAG,IAAA,mBAAQ,EAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,CAAC;QACtE,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAE5C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC1B,CAAC;CACJ;AARD,kDAQC"}
@@ -0,0 +1,2 @@
1
+ export * from "./routers/PotHolesRouter";
2
+ export declare const routers: import("@golemio/core/dist/helpers/routing/AbstractRouter").AbstractRouter[];
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.routers = void 0;
18
+ const PotHolesRouter_1 = require("./routers/PotHolesRouter");
19
+ __exportStar(require("./routers/PotHolesRouter"), exports);
20
+ exports.routers = [PotHolesRouter_1.v1PotHolesRouter];
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/output-gateway/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6DAA4D;AAE5D,2DAAyC;AAE5B,QAAA,OAAO,GAAG,CAAC,iCAAgB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { DependencyContainer } from "@golemio/core/dist/shared/tsyringe";
2
+ declare const potHolesContainer: DependencyContainer;
3
+ export { potHolesContainer as PotHolesContainer };
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PotHolesContainer = void 0;
4
+ const PotholesController_1 = require("../controllers/PotholesController");
5
+ const PotholesRepository_1 = require("../repositories/PotholesRepository");
6
+ const PotholesDtoTransformation_1 = require("../transformation/PotholesDtoTransformation");
7
+ const Di_1 = require("@golemio/core/dist/output-gateway/ioc/Di");
8
+ const ModuleContainerToken_1 = require("./ModuleContainerToken");
9
+ //container
10
+ const potHolesContainer = Di_1.OutputGatewayContainer.createChildContainer();
11
+ exports.PotHolesContainer = potHolesContainer;
12
+ //#region Repositories
13
+ potHolesContainer.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.PotholesRepository, PotholesRepository_1.PotholesRepository);
14
+ //#endregion
15
+ //#region Transformations
16
+ potHolesContainer.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.PotholesTransformation, PotholesDtoTransformation_1.PotholesTransformation);
17
+ //#endregion
18
+ //#region Controllers
19
+ potHolesContainer.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.PotholesController, PotholesController_1.PotholesController);
20
+ //# sourceMappingURL=Di.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../src/output-gateway/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,0EAAwE;AACxE,2EAAyE;AACzE,2FAAsF;AACtF,iEAAkF;AAElF,iEAA8D;AAE9D,WAAW;AACX,MAAM,iBAAiB,GAAwB,2BAAsB,CAAC,oBAAoB,EAAE,CAAC;AAc/D,8CAAiB;AAZ/C,sBAAsB;AACtB,iBAAiB,CAAC,iBAAiB,CAAC,2CAAoB,CAAC,kBAAkB,EAAE,uCAAkB,CAAC,CAAC;AACjG,YAAY;AAEZ,yBAAyB;AACzB,iBAAiB,CAAC,iBAAiB,CAAC,2CAAoB,CAAC,sBAAsB,EAAE,kDAAsB,CAAC,CAAC;AACzG,YAAY;AAEZ,qBAAqB;AACrB,iBAAiB,CAAC,iBAAiB,CAAC,2CAAoB,CAAC,kBAAkB,EAAE,uCAAkB,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ declare const ModuleContainerToken: {
2
+ PotholesRepository: symbol;
3
+ PotholesTransformation: symbol;
4
+ PotholesController: symbol;
5
+ };
6
+ export { ModuleContainerToken };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ModuleContainerToken = void 0;
4
+ const ModuleContainerToken = {
5
+ PotholesRepository: Symbol(),
6
+ PotholesTransformation: Symbol(),
7
+ PotholesController: Symbol(),
8
+ };
9
+ exports.ModuleContainerToken = ModuleContainerToken;
10
+ //# sourceMappingURL=ModuleContainerToken.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModuleContainerToken.js","sourceRoot":"","sources":["../../../src/output-gateway/ioc/ModuleContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,oBAAoB,GAAG;IACzB,kBAAkB,EAAE,MAAM,EAAE;IAC5B,sBAAsB,EAAE,MAAM,EAAE;IAChC,kBAAkB,EAAE,MAAM,EAAE;CAC/B,CAAC;AAEO,oDAAoB"}
@@ -0,0 +1,10 @@
1
+ import { IPothole } from "../domain/IPothole";
2
+ import { IPotholesRepository } from "../domain/IPotholesRepository";
3
+ import { SequelizeModel } from "@golemio/core/dist/output-gateway/models";
4
+ import { IPotholesParams } from "../domain/IPotholesParams";
5
+ export declare class PotholesRepository extends SequelizeModel implements IPotholesRepository {
6
+ constructor();
7
+ GetAll(params: Partial<IPotholesParams>): Promise<IPothole[]>;
8
+ private prepareWhereAndOrder;
9
+ GetOne(id: any): Promise<any>;
10
+ }
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.PotholesRepository = void 0;
27
+ const index_1 = require("../../schema-definitions/index");
28
+ const models_1 = require("@golemio/core/dist/output-gateway/models");
29
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
30
+ const sequelize_1 = __importStar(require("@golemio/core/dist/shared/sequelize"));
31
+ const PotholeModel_1 = require("./models/PotholeModel");
32
+ class PotholesRepository extends models_1.SequelizeModel {
33
+ constructor() {
34
+ super("PotholesRepository", "v_waze_potholes_v2", PotholeModel_1.PotholeModel.attributeModel, {
35
+ schema: index_1.WazeCCP.pgSchema,
36
+ });
37
+ }
38
+ GetAll(params) {
39
+ try {
40
+ const { whereAttributes, order } = this.prepareWhereAndOrder(params);
41
+ const bindParams = {
42
+ dateFrom: params.dateFrom,
43
+ dateTo: params.dateTo,
44
+ };
45
+ return this.sequelizeModel.findAll({
46
+ attributes: {
47
+ exclude: [
48
+ "pub_millis",
49
+ "pub_utc_date",
50
+ "country",
51
+ "report_description",
52
+ "report_rating",
53
+ "type",
54
+ "subtype",
55
+ "report_by_municipality_user",
56
+ "thumbs_up",
57
+ "jam_uuid",
58
+ "downloaded_at",
59
+ "create_batch_id",
60
+ "created_at",
61
+ "created_by",
62
+ "update_batch_id",
63
+ "updated_by",
64
+ ],
65
+ },
66
+ where: whereAttributes,
67
+ limit: params.limit,
68
+ offset: params.offset,
69
+ order,
70
+ bind: bindParams,
71
+ raw: true,
72
+ });
73
+ }
74
+ catch (err) {
75
+ throw new golemio_errors_1.GeneralError("Database error ~ GetAll Potholes", this.name, err, 500);
76
+ }
77
+ }
78
+ prepareWhereAndOrder(params) {
79
+ let whereAttributes = {
80
+ subtype: "HAZARD_ON_ROAD_POT_HOLE",
81
+ };
82
+ const order = [];
83
+ order.push([sequelize_1.default.col("uuid"), "asc"]);
84
+ order.push([sequelize_1.default.col("pub_utc_date"), "desc"]);
85
+ const literalConditions = [];
86
+ if (params.dateFrom) {
87
+ literalConditions.push(sequelize_1.default.literal(`(pub_utc_date > $dateFrom)`));
88
+ }
89
+ if (params.dateTo) {
90
+ literalConditions.push(sequelize_1.default.literal(`(pub_utc_date <= $dateTo)`));
91
+ }
92
+ if (literalConditions.length > 0) {
93
+ whereAttributes = Object.assign(Object.assign({}, whereAttributes), { [sequelize_1.Op.and]: literalConditions });
94
+ }
95
+ return { whereAttributes, order };
96
+ }
97
+ GetOne(id) {
98
+ throw new Error("Method not implemented.");
99
+ }
100
+ }
101
+ exports.PotholesRepository = PotholesRepository;
102
+ //# sourceMappingURL=PotholesRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PotholesRepository.js","sourceRoot":"","sources":["../../../src/output-gateway/repositories/PotholesRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,0DAAqC;AACrC,qEAA0E;AAC1E,6EAAwE;AACxE,iFAAoE;AAEpE,wDAAqD;AAErD,MAAa,kBAAmB,SAAQ,uBAAc;IAClD;QACI,KAAK,CAAC,oBAAoB,EAAE,oBAAoB,EAAE,2BAAY,CAAC,cAAc,EAAE;YAC3E,MAAM,EAAE,eAAO,CAAC,QAAQ;SAC3B,CAAC,CAAC;IACP,CAAC;IAEM,MAAM,CAAC,MAAgC;QAC1C,IAAI;YACA,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;YAErE,MAAM,UAAU,GAAG;gBACf,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,MAAM,EAAE,MAAM,CAAC,MAAM;aACxB,CAAC;YAEF,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAe;gBAC7C,UAAU,EAAE;oBACR,OAAO,EAAE;wBACL,YAAY;wBACZ,cAAc;wBACd,SAAS;wBACT,oBAAoB;wBACpB,eAAe;wBACf,MAAM;wBACN,SAAS;wBACT,6BAA6B;wBAC7B,WAAW;wBACX,UAAU;wBACV,eAAe;wBACf,iBAAiB;wBACjB,YAAY;wBACZ,YAAY;wBACZ,iBAAiB;wBACjB,YAAY;qBACf;iBACJ;gBACD,KAAK,EAAE,eAAe;gBACtB,KAAK,EAAE,MAAM,CAA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
1
+ import { IPothole } from "../../domain/IPothole";
2
+ import { AlertDto } from "../../../schema-definitions/models/AlertDto";
3
+ import { DataTypes } from "@golemio/core/dist/shared/sequelize";
4
+ export declare class PotholeModel extends AlertDto implements IPothole {
5
+ road_type_name: string | null;
6
+ published_at: Date;
7
+ last_reported: Date;
8
+ static attributeModel: {
9
+ road_type_name: {
10
+ type: DataTypes.TextDataTypeConstructor;
11
+ };
12
+ published_at: {
13
+ type: DataTypes.DateDataTypeConstructor;
14
+ allowNull: boolean;
15
+ };
16
+ last_reported: {
17
+ type: DataTypes.DateDataTypeConstructor;
18
+ allowNull: boolean;
19
+ };
20
+ };
21
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PotholeModel = void 0;
4
+ const AlertDto_1 = require("../../../schema-definitions/models/AlertDto");
5
+ const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
6
+ class PotholeModel extends AlertDto_1.AlertDto {
7
+ }
8
+ exports.PotholeModel = PotholeModel;
9
+ PotholeModel.attributeModel = Object.assign(Object.assign({}, AlertDto_1.AlertDto.attributeModel), { road_type_name: { type: sequelize_1.DataTypes.TEXT }, published_at: { type: sequelize_1.DataTypes.DATE, allowNull: false }, last_reported: { type: sequelize_1.DataTypes.DATE, allowNull: false } });
10
+ //# sourceMappingURL=PotholeModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PotholeModel.js","sourceRoot":"","sources":["../../../../src/output-gateway/repositories/models/PotholeModel.ts"],"names":[],"mappings":";;;AACA,0EAAgD;AAChD,mEAAgE;AAEhE,MAAa,YAAa,SAAQ,mBAAQ;;AAA1C,oCAWC;AANiB,2BAAc,mCACrB,mBAAQ,CAAC,cAAc,KAC1B,cAAc,EAAE,EAAE,IAAI,EAAE,qBAAS,CAAC,IAAI,EAAE,EACxC,YAAY,EAAE,EAAE,IAAI,EAAE,qBAAS,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,EACxD,aAAa,EAAE,EAAE,IAAI,EAAE,qBAAS,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAC3D"}
@@ -0,0 +1,8 @@
1
+ import { AbstractRouter } from "@golemio/core/dist/helpers/routing/AbstractRouter";
2
+ export declare class PotHolesRouter extends AbstractRouter {
3
+ private controller;
4
+ constructor();
5
+ protected initRoutes(expire?: string | number | undefined): void;
6
+ }
7
+ declare const v1PotHolesRouter: AbstractRouter;
8
+ export { v1PotHolesRouter };
@@ -0,0 +1,36 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.v1PotHolesRouter = exports.PotHolesRouter = void 0;
13
+ const AbstractRouter_1 = require("@golemio/core/dist/helpers/routing/AbstractRouter");
14
+ const express_validator_1 = require("@golemio/core/dist/shared/express-validator");
15
+ const Validation_1 = require("@golemio/core/dist/output-gateway/Validation");
16
+ const redis_1 = require("@golemio/core/dist/output-gateway/redis");
17
+ const Di_1 = require("../ioc/Di");
18
+ const ModuleContainerToken_1 = require("../ioc/ModuleContainerToken");
19
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
20
+ let PotHolesRouter = exports.PotHolesRouter = class PotHolesRouter extends AbstractRouter_1.AbstractRouter {
21
+ constructor() {
22
+ super("v1", "potholes");
23
+ this.controller = Di_1.PotHolesContainer.resolve(ModuleContainerToken_1.ModuleContainerToken.PotholesController);
24
+ this.initRoutes();
25
+ }
26
+ initRoutes(expire) {
27
+ this.router.get("/data", [(0, express_validator_1.query)("from").optional().isISO8601(), (0, express_validator_1.query)("to").optional().isISO8601()], Validation_1.pagination, Validation_1.checkErrors, (0, Validation_1.paginationLimitMiddleware)(this.path), (0, redis_1.useCacheMiddleware)(), this.controller.getAll);
28
+ }
29
+ };
30
+ exports.PotHolesRouter = PotHolesRouter = __decorate([
31
+ (0, tsyringe_1.injectable)(),
32
+ __metadata("design:paramtypes", [])
33
+ ], PotHolesRouter);
34
+ const v1PotHolesRouter = new PotHolesRouter();
35
+ exports.v1PotHolesRouter = v1PotHolesRouter;
36
+ //# sourceMappingURL=PotHolesRouter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PotHolesRouter.js","sourceRoot":"","sources":["../../../src/output-gateway/routers/PotHolesRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sFAAmF;AACnF,mFAAoE;AACpE,6EAAkH;AAClH,mEAA6E;AAE7E,kCAA+C;AAC/C,sEAAoE;AACpE,iEAAgE;AAGzD,IAAM,cAAc,4BAApB,MAAM,cAAe,SAAQ,+BAAc;IAE9C;QACI,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,sBAAiB,CAAC,OAAO,CAAsB,2CAAoB,CAAC,kBAAkB,CAAC,CAAC;QAC1G,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;IAES,UAAU,CAAC,MAAoC;QACrD,IAAI,CAAC,MAAM,CAAC,GAAG,CACX,OAAO,EACP,CAAC,IAAA,yBAAK,EAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,EAAE,IAAA,yBAAK,EAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC,EAC1E,uBAAU,EACV,wBAAW,EACX,IAAA,sCAAyB,EAAC,IAAI,CAAC,IAAI,CAAC,EACpC,IAAA,0BAAkB,GAAE,EACpB,IAAI,CAAC,UAAU,CAAC,MAAM,CACzB,CAAC;IACN,CAAC;CACJ,CAAA;yBAnBY,cAAc;IAD1B,IAAA,qBAAU,GAAE;;GACA,cAAc,CAmB1B;AAED,MAAM,gBAAgB,GAAmB,IAAI,cAAc,EAAE,CAAC;AAErD,4CAAgB"}
@@ -0,0 +1,7 @@
1
+ import { IPothole } from "../domain/IPothole";
2
+ import { AbstractTransformation } from "@golemio/core/dist/helpers/transformation/AbstractTransformation";
3
+ import { IGeoJSONFeature } from "@golemio/core/dist/output-gateway";
4
+ export declare class PotholesTransformation extends AbstractTransformation<IPothole, IGeoJSONFeature> {
5
+ name: string;
6
+ protected transformInternal: (element: IPothole) => IGeoJSONFeature;
7
+ }
@@ -0,0 +1,39 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.PotholesTransformation = void 0;
10
+ const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation");
11
+ const output_gateway_1 = require("@golemio/core/dist/output-gateway");
12
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
13
+ let PotholesTransformation = exports.PotholesTransformation = class PotholesTransformation extends AbstractTransformation_1.AbstractTransformation {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.name = "PotholesTransformation";
17
+ this.transformInternal = (element) => {
18
+ var _a, _b, _c, _d, _e, _f, _g;
19
+ const properties = {
20
+ uuid: element.uuid,
21
+ city: (_a = element.city) !== null && _a !== void 0 ? _a : null,
22
+ street: (_b = element.street) !== null && _b !== void 0 ? _b : null,
23
+ road_type: (_c = element.road_type_name) !== null && _c !== void 0 ? _c : null,
24
+ event_direction: (_d = element.magvar) !== null && _d !== void 0 ? _d : null,
25
+ published_at: element.published_at,
26
+ valid_from: element.valid_from,
27
+ last_reported_at: element.last_reported,
28
+ reliability: (_e = element.reliability) !== null && _e !== void 0 ? _e : null,
29
+ confidence: (_f = element.confidence) !== null && _f !== void 0 ? _f : null,
30
+ duplicate_count: (_g = element.duplicate_count) !== null && _g !== void 0 ? _g : null,
31
+ };
32
+ return (0, output_gateway_1.buildGeojsonFeature)(Object.assign(Object.assign({}, properties), { lon: element.location.x, lat: element.location.y }), "lon", "lat", true);
33
+ };
34
+ }
35
+ };
36
+ exports.PotholesTransformation = PotholesTransformation = __decorate([
37
+ (0, tsyringe_1.injectable)()
38
+ ], PotholesTransformation);
39
+ //# sourceMappingURL=PotholesDtoTransformation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PotholesDtoTransformation.js","sourceRoot":"","sources":["../../../src/output-gateway/transformation/PotholesDtoTransformation.ts"],"names":[],"mappings":";;;;;;;;;AAEA,6GAA0G;AAC1G,sEAAyF;AACzF,iEAAgE;AAGzD,IAAM,sBAAsB,oCAA5B,MAAM,sBAAuB,SAAQ,+CAAiD;IAAtF;;QACI,SAAI,GAAW,wBAAwB,CAAC;QAErC,sBAAiB,GAAG,CAAC,OAAiB,EAAE,EAAE;;YAChD,MAAM,UAAU,GAAuB;gBACnC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,IAAI,EAAE,MAAA,OAAO,CAAC,IAAI,mCAAI,IAAI;gBAC1B,MAAM,EAAE,MAAA,OAAO,CAAC,MAAM,mCAAI,IAAI;gBAC9B,SAAS,EAAE,MAAA,OAAO,CAAC,cAAc,mCAAI,IAAI;gBACzC,eAAe,EAAE,MAAA,OAAO,CAAC,MAAM,mCAAI,IAAI;gBACvC,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,gBAAgB,EAAE,OAAO,CAAC,aAAa;gBACvC,WAAW,EAAE,MAAA,OAAO,CAAC,WAAW,mCAAI,IAAI;gBACxC,UAAU,EAAE,MAAA,OAAO,CAAC,UAAU,mCAAI,IAAI;gBACtC,eAAe,EAAE,MAAA,OAAO,CAAC,eAAe,mCAAI,IAAI;aACnD,CAAC;YAEF,OAAO,IAAA,oCAAmB,kCAAM,UAAU,KAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAI,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACxH,CAAC,CAAC;IACN,CAAC;CAAA,CAAA;iCApBY,sBAAsB;IADlC,IAAA,qBAAU,GAAE;GACA,sBAAsB,CAoBlC"}
@@ -0,0 +1,153 @@
1
+ openapi: 3.0.3
2
+ info:
3
+ title: 👻 Waze
4
+ description: >-
5
+ <p>💡👻 Waze.</p>
6
+ version: 1.0.0
7
+ contact:
8
+ name: Golemio Prague Data Platform
9
+ email: golemio@operatorict.cz
10
+ url: https://golemio.cz
11
+
12
+ servers:
13
+ - url: https://rabin.golemio.cz
14
+ description: Test (development) server
15
+ - url: https://api.golemio.cz
16
+ description: Main (production) server
17
+
18
+ paths:
19
+ /v1/potholes/data:
20
+ get:
21
+ summary: GET All Pot holes
22
+ description: Provides information about pot holes
23
+ tags:
24
+ - 👻 Waze (v1)
25
+ operationId: getPotHoles
26
+ parameters:
27
+ - name: from
28
+ in: query
29
+ description: Date in ISO8601, limit to pothole alerts published by Waze from this datetime
30
+ required: false
31
+ schema:
32
+ type: string
33
+ example: "2020-05-16T04:27:58.000Z"
34
+ - name: to
35
+ in: query
36
+ description: Date in ISO8601, limit to pothole alerts published by Waze until this datetime (default 7 days into past)
37
+ required: false
38
+ schema:
39
+ type: string
40
+ example: "2020-05-18T04:27:58.000Z"
41
+ - name: limit
42
+ in: query
43
+ description: >-
44
+ Limits number of retrieved items.
45
+ required: false
46
+ schema:
47
+ type: integer
48
+ format: int64
49
+ example: 10
50
+ - name: offset
51
+ in: query
52
+ description: Number of the first items that are skipped
53
+ required: false
54
+ schema:
55
+ type: integer
56
+ format: int64
57
+ example: 0
58
+ responses:
59
+ "200":
60
+ description: successful operation
61
+ content:
62
+ application/json:
63
+ schema:
64
+ $ref: "#/components/schemas/PotHolesCollection"
65
+ "401":
66
+ $ref: "#/components/responses/UnauthorizedError"
67
+ "404":
68
+ description: Not found
69
+ components:
70
+ responses:
71
+ UnauthorizedError:
72
+ description: API key is missing or invalid
73
+ headers:
74
+ WWW_Authenticate:
75
+ schema:
76
+ type: string
77
+
78
+ schemas:
79
+ PotHolesCollection:
80
+ type: object
81
+ properties:
82
+ features:
83
+ type: array
84
+ items:
85
+ $ref: "#/components/schemas/Potholes"
86
+ type:
87
+ type: string
88
+ example: FeatureCollection
89
+ Potholes:
90
+ type: object
91
+ properties:
92
+ geometry:
93
+ type: object
94
+ description: incident location
95
+ properties:
96
+ coordinates:
97
+ type: array
98
+ items:
99
+ type: number
100
+ example: [14.416880835710145, 50.089021646755796]
101
+ type:
102
+ type: string
103
+ example: Point
104
+ properties:
105
+ type: object
106
+ properties:
107
+ uuid:
108
+ type: string
109
+ description: incident unique ID according to Waze
110
+ example: "a6771712-9256-b870-c6d3-e232d9bc7b1a"
111
+ city:
112
+ type: string
113
+ description: city
114
+ example: "Praha"
115
+ street:
116
+ type: string
117
+ description: street
118
+ example: "Liberecká"
119
+ road_type:
120
+ type: string
121
+ description: road type/class/level
122
+ example: 3
123
+ event_direction:
124
+ type: integer
125
+ description: driving angle in degrees according to the reporting driver; 0-359, 0=North
126
+ example: 41
127
+ published_at:
128
+ type: string
129
+ description: uuid publication date and time from Waze
130
+ example: "2023-11-20 15:38:04.105+01"
131
+ valid_from:
132
+ type: string
133
+ description: recording date and time to database
134
+ example: "2023-11-20 15:38:04.105+01"
135
+ last_reported_at:
136
+ type: string
137
+ description: date and time of last received incident to database
138
+ example: "2023-11-20 15:38:04.105+01"
139
+ reliability:
140
+ type: integer
141
+ description: reliability score based on other user’s reactions ('Thumbs up' etc.) and the level of the reporter; range 0-10, 10=max.
142
+ example: 5
143
+ confidence:
144
+ type: integer
145
+ description: confidence score based only on other user’s reactions ('Thumbs up' etc.); range 0-10, 10=max.
146
+ example: 0
147
+ duplicate_count:
148
+ type: integer
149
+ description: how many of one, two or more identical incidents with the same 'uuid' was dumped; 0=origin, 1=the first duplicate appeared
150
+ example: 1
151
+ type:
152
+ type: string
153
+ example: Feature
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/waze-ccp",
3
- "version": "1.1.8",
3
+ "version": "1.1.9-rc.1088929029",
4
4
  "description": "Golemio Waze CCP Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,10 +8,14 @@
8
8
  "build": "rimraf ./dist && tspc -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
+ "pretest": "golemio import-db-data --postgres",
11
12
  "test": "cross-env NODE_ENV=test mocha --exit --check-leaks --timeout 120000 -r ts-node/register -r tsconfig-paths/register -r dotenv/config --file 'test/setup.ts' 'test/**/*.test.ts'",
12
13
  "test-debug": "run-s 'test -- --inspect-brk=9230'",
13
14
  "code-coverage": "nyc run-s 'test -- -r source-map-support/register'",
15
+ "apidocs-test": "npm run apidocs-test-output",
16
+ "apidocs-test-output": "cross-env NODE_ENV=test golemio swagger api-test --oas docs/openapi-output.yaml --script test/api-docs/output-gateway/server.js",
14
17
  "generate-docs": "typedoc --out docs/typedoc src",
18
+ "migrate-db": "golemio migrate-db up --postgres",
15
19
  "lint": "eslint --cache \"{src,test}/**/*.ts\""
16
20
  },
17
21
  "keywords": [
@@ -29,6 +33,7 @@
29
33
  "yarn": "Use npm!"
30
34
  },
31
35
  "devDependencies": {
36
+ "@apideck/portman": "^1.23.1",
32
37
  "@commitlint/cli": "^11.0.0",
33
38
  "@commitlint/config-conventional": "^11.0.0",
34
39
  "@golemio/cli": "1.5.0",
@@ -41,6 +46,7 @@
41
46
  "@types/node": "^18.13.0",
42
47
  "@types/object-hash": "^1.3.0",
43
48
  "@types/sinon": "^9.0.10",
49
+ "@types/supertest": "^2.0.16",
44
50
  "chai": "4.2.0",
45
51
  "chai-as-promised": "7.1.1",
46
52
  "cross-env": "^7.0.3",
@@ -54,6 +60,7 @@
54
60
  "rimraf": "^3.0.2",
55
61
  "sinon": "^9.2.3",
56
62
  "source-map-support": "0.5.21",
63
+ "supertest": "^6.3.3",
57
64
  "ts-node": "^10.9.1",
58
65
  "ts-patch": "3.0.0-beta3",
59
66
  "tsconfig-paths": "^4.2.0",