@golemio/waze-ccp 1.2.5 → 1.2.6-dev.2085875023
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/integration-engine/WazeCCPAlertsTransformation.js +14 -15
- package/dist/integration-engine/WazeCCPAlertsTransformation.js.map +1 -1
- package/dist/integration-engine/WazeCCPIrregularitiesTransformation.js +7 -13
- package/dist/integration-engine/WazeCCPIrregularitiesTransformation.js.map +1 -1
- package/dist/integration-engine/WazeCCPJamsTransformation.js +7 -13
- package/dist/integration-engine/WazeCCPJamsTransformation.js.map +1 -1
- package/dist/integration-engine/WazeCCPWorker.js +19 -28
- package/dist/integration-engine/WazeCCPWorker.js.map +1 -1
- package/dist/integration-engine/helpers/AlertsIdHelper.js +3 -4
- package/dist/integration-engine/helpers/AlertsIdHelper.js.map +1 -1
- package/dist/integration-engine/repositories/WazeAlertsRepository.js +8 -17
- package/dist/integration-engine/repositories/WazeAlertsRepository.js.map +1 -1
- package/dist/output-gateway/controllers/PotholesController.d.ts +2 -3
- package/dist/output-gateway/controllers/PotholesController.js +6 -41
- package/dist/output-gateway/controllers/PotholesController.js.map +1 -1
- package/dist/output-gateway/domain/IPotholesController.d.ts +3 -3
- package/dist/output-gateway/repositories/PotholesRepository.js +4 -1
- package/dist/output-gateway/repositories/PotholesRepository.js.map +1 -1
- package/dist/output-gateway/repositories/models/PotholeModel.js +6 -1
- package/dist/output-gateway/repositories/models/PotholeModel.js.map +1 -1
- package/dist/output-gateway/routers/PotHolesRouter.d.ts +2 -0
- package/dist/output-gateway/routers/PotHolesRouter.js +29 -1
- package/dist/output-gateway/routers/PotHolesRouter.js.map +1 -1
- package/dist/output-gateway/transformation/PotholesDtoTransformation.js +8 -9
- package/dist/output-gateway/transformation/PotholesDtoTransformation.js.map +1 -1
- package/package.json +2 -2
|
@@ -12,27 +12,26 @@ class WazeCCPAlertsTransformation extends AbstractTransformation_1.AbstractTrans
|
|
|
12
12
|
super();
|
|
13
13
|
this.name = index_1.WazeCCP.alerts.name + "Transformation";
|
|
14
14
|
this.transformInternal = (alert) => {
|
|
15
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
16
15
|
return {
|
|
17
|
-
city:
|
|
18
|
-
confidence:
|
|
19
|
-
country:
|
|
16
|
+
city: alert.city ?? null,
|
|
17
|
+
confidence: alert.confidence ?? null,
|
|
18
|
+
country: alert.country ?? null,
|
|
20
19
|
downloaded_at: this.downloadedAt,
|
|
21
20
|
id: AlertsIdHelper_1.default.GenerateUuid(alert),
|
|
22
|
-
jam_uuid:
|
|
21
|
+
jam_uuid: alert.jamUuid ?? null,
|
|
23
22
|
location: alert.location,
|
|
24
|
-
magvar:
|
|
25
|
-
pub_millis:
|
|
23
|
+
magvar: alert.magvar ?? null,
|
|
24
|
+
pub_millis: alert.pubMillis?.toString(),
|
|
26
25
|
pub_utc_date: new Date(+alert.pubMillis),
|
|
27
|
-
reliability:
|
|
26
|
+
reliability: alert.reliability ?? null,
|
|
28
27
|
report_by_municipality_user: alert.reportByMunicipalityUser === "true",
|
|
29
|
-
report_description:
|
|
30
|
-
report_rating:
|
|
31
|
-
road_type:
|
|
32
|
-
street:
|
|
33
|
-
subtype:
|
|
34
|
-
thumbs_up:
|
|
35
|
-
type:
|
|
28
|
+
report_description: alert.reportDescription ?? null,
|
|
29
|
+
report_rating: alert.reportRating ?? null,
|
|
30
|
+
road_type: alert.roadType ?? null,
|
|
31
|
+
street: alert.street ?? null,
|
|
32
|
+
subtype: alert.subtype ?? null,
|
|
33
|
+
thumbs_up: alert.nThumbsUp ?? null,
|
|
34
|
+
type: alert.type ?? null,
|
|
36
35
|
uuid: alert.uuid,
|
|
37
36
|
};
|
|
38
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WazeCCPAlertsTransformation.js","sourceRoot":"","sources":["../../src/integration-engine/WazeCCPAlertsTransformation.ts"],"names":[],"mappings":";;;;;;AAAA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EAAE,KAAK,CAAC,iBAAiB,IAAI,IAAI;gBACnD,aAAa,EAAE,KAAK,CAAC,YAAY,IAAI,IAAI;gBACzC,SAAS,EAAE,KAAK,CAAC,QAAQ,IAAI,IAAI;gBACjC,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,IAAI;gBAC5B,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,IAAI;gBAC9B,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,IAAI;gBAClC,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,IAAI;gBACxB,IAAI,EAAE,KAAK,CAAC,IAAI;aACnB,CAAC;QACN,CAAC,CAAC;QA1BE,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;IAClC,CAAC;CA0BJ;AAjCD,kEAiCC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.WazeCCPIrregularitiesTransformation = void 0;
|
|
13
4
|
const index_1 = require("../schema-definitions/index");
|
|
@@ -20,7 +11,7 @@ class WazeCCPIrregularitiesTransformation extends transformations_1.BaseTransfor
|
|
|
20
11
|
/**
|
|
21
12
|
* Transform the whole collection or one single element
|
|
22
13
|
*/
|
|
23
|
-
this.transform = (data) =>
|
|
14
|
+
this.transform = async (data) => {
|
|
24
15
|
const rootStart = data.startTimeMillis;
|
|
25
16
|
const downloadedAt = data.downloadedAt;
|
|
26
17
|
if (!data.irregularities) {
|
|
@@ -29,14 +20,17 @@ class WazeCCPIrregularitiesTransformation extends transformations_1.BaseTransfor
|
|
|
29
20
|
}
|
|
30
21
|
const results = [];
|
|
31
22
|
data.irregularities.forEach((element) => {
|
|
32
|
-
const res = this.transformElement(
|
|
33
|
-
|
|
23
|
+
const res = this.transformElement({
|
|
24
|
+
...element,
|
|
25
|
+
downloadedAt,
|
|
26
|
+
rootStart,
|
|
27
|
+
});
|
|
34
28
|
if (res) {
|
|
35
29
|
results.push(res);
|
|
36
30
|
}
|
|
37
31
|
});
|
|
38
32
|
return results;
|
|
39
|
-
}
|
|
33
|
+
};
|
|
40
34
|
this.transformElement = (irregularity) => {
|
|
41
35
|
const rootStart = irregularity.rootStart;
|
|
42
36
|
delete irregularity.rootStart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WazeCCPIrregularitiesTransformation.js","sourceRoot":"","sources":["../../src/integration-engine/WazeCCPIrregularitiesTransformation.ts"],"names":[],"mappings":"
|
|
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,KAAK,EAAE,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;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S,EAAE,YAAY,CAAC,QAAQ;gBAChC,MAAM,EAAE,YAAY,CAAC,MAAM;gBAC3B,IAAI,EAAE,YAAY,CAAC,IAAI;gBACvB,UAAU,EAAE,YAAY,CAAC,SAAS;gBAClC,QAAQ,EAAE,YAAY,CAAC,OAAO;gBAC9B,WAAW,EAAE,YAAY,CAAC,SAAS;gBACnC,aAAa,EAAE,YAAY,CAAC,YAAY;gBACxC,OAAO,EAAE,YAAY,CAAC,OAAO;gBAC7B,QAAQ,EAAE,YAAY,CAAC,QAAQ;gBAC/B,KAAK,EAAE,YAAY,CAAC,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"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.WazeCCPJamsTransformation = void 0;
|
|
13
4
|
const index_1 = require("../schema-definitions/index");
|
|
@@ -20,7 +11,7 @@ class WazeCCPJamsTransformation extends transformations_1.BaseTransformation {
|
|
|
20
11
|
/**
|
|
21
12
|
* Transform the whole collection or one single element
|
|
22
13
|
*/
|
|
23
|
-
this.transform = (data) =>
|
|
14
|
+
this.transform = async (data) => {
|
|
24
15
|
const rootStart = data.startTimeMillis;
|
|
25
16
|
const downloadedAt = data.downloadedAt;
|
|
26
17
|
if (!data.jams) {
|
|
@@ -29,14 +20,17 @@ class WazeCCPJamsTransformation extends transformations_1.BaseTransformation {
|
|
|
29
20
|
}
|
|
30
21
|
const results = [];
|
|
31
22
|
data.jams.forEach((element) => {
|
|
32
|
-
const res = this.transformElement(
|
|
33
|
-
|
|
23
|
+
const res = this.transformElement({
|
|
24
|
+
...element,
|
|
25
|
+
downloadedAt,
|
|
26
|
+
rootStart,
|
|
27
|
+
});
|
|
34
28
|
if (res) {
|
|
35
29
|
results.push(res);
|
|
36
30
|
}
|
|
37
31
|
});
|
|
38
32
|
return results;
|
|
39
|
-
}
|
|
33
|
+
};
|
|
40
34
|
this.transformElement = (jam) => {
|
|
41
35
|
const rootStart = jam.rootStart;
|
|
42
36
|
delete jam.rootStart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WazeCCPJamsTransformation.js","sourceRoot":"","sources":["../../src/integration-engine/WazeCCPJamsTransformation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WazeCCPJamsTransformation.js","sourceRoot":"","sources":["../../src/integration-engine/WazeCCPJamsTransformation.ts"],"names":[],"mappings":";;;AAAA,uDAAqC;AACrC,2EAAoE;AACpE,2FAA4G;AAC5G,iDAAiE;AAEjE,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3B,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,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.WazeCCPWorker = void 0;
|
|
13
4
|
const WazeAlertsRepository_1 = require("./repositories/WazeAlertsRepository");
|
|
@@ -25,8 +16,8 @@ const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
|
|
|
25
16
|
class WazeCCPWorker extends workers_1.BaseWorker {
|
|
26
17
|
constructor() {
|
|
27
18
|
super();
|
|
28
|
-
this.refreshAlertsInDB = (msg) =>
|
|
29
|
-
const data =
|
|
19
|
+
this.refreshAlertsInDB = async (msg) => {
|
|
20
|
+
const data = await this.dataSourceAlerts.getAll();
|
|
30
21
|
if (!data.alerts) {
|
|
31
22
|
helpers_1.log.warn(`${index_1.WazeCCP.alerts.name}: Data source returned empty data.`);
|
|
32
23
|
return;
|
|
@@ -34,28 +25,28 @@ class WazeCCPWorker extends workers_1.BaseWorker {
|
|
|
34
25
|
const now = new Date();
|
|
35
26
|
const transformationAlerts = new _1.WazeCCPAlertsTransformation(now);
|
|
36
27
|
const transformedData = transformationAlerts.transformArray(data.alerts);
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
this.refreshIrregularitiesInDB = (msg) =>
|
|
40
|
-
const data =
|
|
28
|
+
await this.modelAlerts.saveAlerts(transformedData);
|
|
29
|
+
};
|
|
30
|
+
this.refreshIrregularitiesInDB = async (msg) => {
|
|
31
|
+
const data = await this.dataSourceIrregularities.getAll();
|
|
41
32
|
// enrich data by downloadedAt unix timestamp
|
|
42
|
-
const dataWithDownloadAt =
|
|
43
|
-
const transformedData =
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
this.refreshJamsInDB = (msg) =>
|
|
47
|
-
const data =
|
|
33
|
+
const dataWithDownloadAt = { ...data, downloadedAt: new Date() };
|
|
34
|
+
const transformedData = await this.transformationIrregularities.transform(dataWithDownloadAt);
|
|
35
|
+
await this.modelIrregularities.saveBySqlFunction(transformedData, ["id"]);
|
|
36
|
+
};
|
|
37
|
+
this.refreshJamsInDB = async (msg) => {
|
|
38
|
+
const data = await this.dataSourceJams.getAll();
|
|
48
39
|
// enrich data by downloadedAt unix timestamp
|
|
49
|
-
const dataWithDownloadAt =
|
|
50
|
-
const transformedData =
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
this.refreshAllDataInDB = (msg) =>
|
|
40
|
+
const dataWithDownloadAt = { ...data, downloadedAt: new Date() };
|
|
41
|
+
const transformedData = await this.transformationJams.transform(dataWithDownloadAt);
|
|
42
|
+
await this.modelJams.saveBySqlFunction(transformedData, ["id", "pub_utc_date"]);
|
|
43
|
+
};
|
|
44
|
+
this.refreshAllDataInDB = async (msg) => {
|
|
54
45
|
const queueNames = ["refreshAlertsInDB", "refreshIrregularitiesInDB", "refreshJamsInDB"];
|
|
55
|
-
|
|
46
|
+
await Promise.all(queueNames.map((queueName) => {
|
|
56
47
|
return this.sendMessageToExchange("workers." + this.queuePrefix + "." + queueName, "Just do it!");
|
|
57
48
|
}));
|
|
58
|
-
}
|
|
49
|
+
};
|
|
59
50
|
this.dataSourceAlerts = new datasources_1.DataSource(index_1.WazeCCP.alerts.name + "DataSource", new HTTPFetchProtocolStrategy_1.HTTPFetchProtocolStrategy({
|
|
60
51
|
headers: {},
|
|
61
52
|
method: "GET",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WazeCCPWorker.js","sourceRoot":"","sources":["../../src/integration-engine/WazeCCPWorker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WazeCCPWorker.js","sourceRoot":"","sources":["../../src/integration-engine/WazeCCPWorker.ts"],"names":[],"mappings":";;;AAAA,8EAA6E;AAC7E,uDAAqC;AACrC,kFAAgE;AAChE,gEAA4C;AAC5C,yEAAsE;AACtE,mFAAqG;AACrG,6IAA0I;AAC1I,yEAA6E;AAC7E,2EAA2E;AAC3E,mFAAkF;AAClF,yBAAiH;AACjH,2EAAoE;AAEpE,MAAa,aAAc,SAAQ,oBAAU;IAWzC;QACI,KAAK,EAAE,CAA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AAI,sBAAa,CAC9B,eAAO,CAAC,IAAI,CAAC,IAAI,GAAG,OAAO,EAC3B;YACI,yBAAyB,EAAE,eAAM,CAAC,cAAc;YAChD,WAAW,EAAE,eAAO,CAAC,IAAI,CAAC,WAAW;YACrC,QAAQ,EAAE,eAAO,CAAC,QAAQ;YAC1B,UAAU,EAAE,gBAAgB;SAC/B,EACD,IAAI,uCAAmB,CAAC,eAAO,CAAC,IAAI,CAAC,IAAI,GAAG,gBAAgB,EAAE,eAAM,CAAC,UAAU,CAAC,CACnF,CAAC;QAEF,IAAI,CAAC,WAAW,GAAG,eAAM,CAAC,oBAAoB,GAAG,GAAG,GAAG,eAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;IACtF,CAAC;CAuCJ;AA9GD,sCA8GC"}
|
|
@@ -11,12 +11,11 @@ class AlertsIdHelper {
|
|
|
11
11
|
// type, subtype, report_by_municipality_user::text,jam_uuid
|
|
12
12
|
// ))::uuid
|
|
13
13
|
static GenerateUuid(alert) {
|
|
14
|
-
var _a, _b, _c;
|
|
15
14
|
const hashString = [
|
|
16
|
-
|
|
15
|
+
alert.pubMillis?.toString(),
|
|
17
16
|
alert.roadType,
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
alert.location?.x,
|
|
18
|
+
alert.location?.y,
|
|
20
19
|
alert.street,
|
|
21
20
|
alert.city,
|
|
22
21
|
alert.country,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertsIdHelper.js","sourceRoot":"","sources":["../../../src/integration-engine/helpers/AlertsIdHelper.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAG5B,MAAqB,cAAc;IAC/B,QAAQ;IACR,iBAAiB;IACjB,yFAAyF;IACzF,gEAAgE;IAChE,WAAW;IACJ,MAAM,CAAC,YAAY,CAAC,KAAuB
|
|
1
|
+
{"version":3,"file":"AlertsIdHelper.js","sourceRoot":"","sources":["../../../src/integration-engine/helpers/AlertsIdHelper.ts"],"names":[],"mappings":";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C,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;IACpH,CAAC;CACJ;AAlCD,iCAkCC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.WazeAlertsRepository = void 0;
|
|
13
4
|
const _sch_1 = require("../../schema-definitions");
|
|
@@ -22,14 +13,14 @@ class WazeAlertsRepository extends models_1.PostgresModel {
|
|
|
22
13
|
pgSchema: _sch_1.WazeCCP.pgSchema,
|
|
23
14
|
savingType: "insertOrUpdate",
|
|
24
15
|
}, new golemio_validator_1.JSONSchemaValidator(_sch_1.WazeCCP.alerts.name + "Validator", AlertDto_1.AlertDto.jsonSchema));
|
|
25
|
-
this.saveAlerts = (data) =>
|
|
16
|
+
this.saveAlerts = async (data) => {
|
|
26
17
|
for (const item of data) {
|
|
27
|
-
|
|
18
|
+
await this.saveAlert(item);
|
|
28
19
|
}
|
|
29
|
-
}
|
|
30
|
-
this.saveAlert = (data) =>
|
|
31
|
-
if (
|
|
32
|
-
const record =
|
|
20
|
+
};
|
|
21
|
+
this.saveAlert = async (data) => {
|
|
22
|
+
if (await this.validate([data])) {
|
|
23
|
+
const record = await this.sequelizeModel.findOne({
|
|
33
24
|
where: {
|
|
34
25
|
id: data.id,
|
|
35
26
|
uuid: data.uuid,
|
|
@@ -43,9 +34,9 @@ class WazeAlertsRepository extends models_1.PostgresModel {
|
|
|
43
34
|
updated_at: data.downloaded_at,
|
|
44
35
|
}, { where: { uuid: data.uuid, id: data.id } });
|
|
45
36
|
}
|
|
46
|
-
return this.sequelizeModel.create(
|
|
37
|
+
return this.sequelizeModel.create({ ...data, duplicate_count: 0, valid_from: data.downloaded_at });
|
|
47
38
|
}
|
|
48
|
-
}
|
|
39
|
+
};
|
|
49
40
|
}
|
|
50
41
|
}
|
|
51
42
|
exports.WazeAlertsRepository = WazeAlertsRepository;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WazeAlertsRepository.js","sourceRoot":"","sources":["../../../src/integration-engine/repositories/WazeAlertsRepository.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WazeAlertsRepository.js","sourceRoot":"","sources":["../../../src/integration-engine/repositories/WazeAlertsRepository.ts"],"names":[],"mappings":";;;AACA,mDAA+B;AAC/B,uEAAgD;AAChD,yEAAqF;AACrF,mFAAkF;AAElF,MAAa,oBAAqB,SAAQ,sBAAa;IACnD;QACI,KAAK,CACD,cAAO,CAAC,MAAM,CAAC,IAAI,GAAG,YAAY,EAClC;YACI,yBAAyB,EAAE,mBAAQ,CAAC,cAAc;YAClD,WAAW,EAAE,cAAO,CAAC,MAAM,CAAC,WAAW;YACvC,QAAQ,EAAE,cAAO,CAAC,QAAQ;YAC1B,UAAU,EAAE,gBAAgB;SAC/B,EACD,IAAI,uCAAmB,CAAC,cAAO,CAAC,MAAM,CAAC,IAAI,GAAG,WAAW,EAAE,mBAAQ,CAAC,UAAU,CAAC,CAClF,CAAC;QAGC,eAAU,GAAG,KAAK,EAAE,IAAmB,EAAE,EAAE;YAC9C,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE;gBACrB,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;aAC9B;QACL,CAAC,CAAC;QAEM,cAAS,GAAG,KAAK,EAAE,IAAiB,EAAE,EAAE;YAC5C,IAAI,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE;gBAC7B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBAC7C,KAAK,EAAE;wBACH,EAAE,EAAE,IAAI,CAAC,EAAE;wBACX,IAAI,EAAE,IAAI,CAAC,IAAI;qBAClB;oBACD,KAAK,EAAE,CAAC,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;iBACrC,CAAC,CAAC;gBACH,IAAI,MAAM,EAAE;oBACR,OAAO,IAAI,CAAC,MAAM,CACd;wBACI,eAAe,EAAE,MAAM,CAAC,eAAe,GAAG,CAAC;wBAC3C,aAAa,EAAE,IAAI,CAAC,aAAa;wBACjC,UAAU,EAAE,IAAI,CAAC,aAAa;qBACjC,EACD,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,CAC9C,CAAC;iBACL;gBAED,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,eAAe,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;aACtG;QACL,CAAC,CAAC;IA9BF,CAAC;CA+BJ;AA3CD,oDA2CC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { IPotholesController } from "../domain/IPotholesController";
|
|
2
|
+
import { IPotholesParams } from "../domain/IPotholesParams";
|
|
2
3
|
import { IPotholesRepository } from "../domain/IPotholesRepository";
|
|
3
4
|
import { IAlertDto } from "../../schema-definitions/interfaces/IAlertDto";
|
|
4
5
|
import { AbstractTransformation } from "@golemio/core/dist/helpers/transformation/AbstractTransformation";
|
|
5
6
|
import { IGeoJSONFeature } from "@golemio/core/dist/output-gateway";
|
|
6
|
-
import { NextFunction, Request, Response } from "@golemio/core/dist/shared/express";
|
|
7
7
|
export declare class PotholesController implements IPotholesController {
|
|
8
8
|
private repository;
|
|
9
9
|
private transformation;
|
|
10
10
|
constructor(repository: IPotholesRepository, transformation: AbstractTransformation<IAlertDto, IGeoJSONFeature>);
|
|
11
|
-
getAll: (
|
|
12
|
-
private parseParams;
|
|
11
|
+
getAll: (params: Partial<IPotholesParams>) => Promise<import("@golemio/core/dist/output-gateway").IGeoJSONFeatureCollection>;
|
|
13
12
|
}
|
|
@@ -11,58 +11,23 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
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
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
15
|
exports.PotholesController = void 0;
|
|
26
16
|
const ModuleContainerToken_1 = require("../ioc/ModuleContainerToken");
|
|
27
|
-
const DateTime_1 = require("@golemio/core/dist/helpers/DateTime");
|
|
28
17
|
const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation");
|
|
29
18
|
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
30
|
-
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
31
19
|
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
32
|
-
let PotholesController = exports.PotholesController =
|
|
20
|
+
let PotholesController = exports.PotholesController = class PotholesController {
|
|
33
21
|
constructor(repository, transformation) {
|
|
34
22
|
this.repository = repository;
|
|
35
23
|
this.transformation = transformation;
|
|
36
|
-
this.getAll = (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
});
|
|
24
|
+
this.getAll = async (params) => {
|
|
25
|
+
const result = await this.repository.GetAll(params);
|
|
26
|
+
return (0, output_gateway_1.buildGeojsonFeatureCollection)(this.transformation.transformArray(result));
|
|
27
|
+
};
|
|
63
28
|
}
|
|
64
29
|
};
|
|
65
|
-
exports.PotholesController = PotholesController =
|
|
30
|
+
exports.PotholesController = PotholesController = __decorate([
|
|
66
31
|
(0, tsyringe_1.injectable)(),
|
|
67
32
|
__param(0, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.PotholesRepository)),
|
|
68
33
|
__param(1, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.PotholesTransformation)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PotholesController.js","sourceRoot":"","sources":["../../../src/output-gateway/controllers/PotholesController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PotholesController.js","sourceRoot":"","sources":["../../../src/output-gateway/controllers/PotholesController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,sEAAoE;AAEpE,6GAA0G;AAC1G,sEAAmG;AACnG,iEAAwE;AAGjE,IAAM,kBAAkB,gCAAxB,MAAM,kBAAkB;IAC3B,YACqD,UAAuC,EAExF,cAA0E;QAFjB,eAAU,GAAV,UAAU,CAAqB;QAEhF,mBAAc,GAAd,cAAc,CAAoD;QAGvE,WAAM,GAAG,KAAK,EAAE,MAAgC,EAAE,EAAE;YACvD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAEpD,OAAO,IAAA,8CAA6B,EAAC,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;QACrF,CAAC,CAAC;IANC,CAAC;CAOP,CAAA;6BAZY,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,CAY9B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import { IGeoJSONFeatureCollection } from "@golemio/core/dist/output-gateway";
|
|
2
|
+
import { IPotholesParams } from "./IPotholesParams";
|
|
3
3
|
export interface IPotholesController {
|
|
4
|
-
getAll(
|
|
4
|
+
getAll(params: Partial<IPotholesParams>): Promise<IGeoJSONFeatureCollection>;
|
|
5
5
|
}
|
|
@@ -90,7 +90,10 @@ class PotholesRepository extends models_1.SequelizeModel {
|
|
|
90
90
|
literalConditions.push(sequelize_1.default.literal(`(pub_utc_date <= $dateTo)`));
|
|
91
91
|
}
|
|
92
92
|
if (literalConditions.length > 0) {
|
|
93
|
-
whereAttributes =
|
|
93
|
+
whereAttributes = {
|
|
94
|
+
...whereAttributes,
|
|
95
|
+
[sequelize_1.Op.and]: literalConditions,
|
|
96
|
+
};
|
|
94
97
|
}
|
|
95
98
|
return { whereAttributes, order };
|
|
96
99
|
}
|
|
@@ -1 +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,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e,GAA2B;YAC1C,OAAO,EAAE,yBAAyB;SACrC,CAAC;QACF,MAAM,KAAK,GAA0B,EAAE,CAAC;QAExC,KAAK,CAAC,IAAI,CAAC,CAAC,mBAAS,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QAC3C,KAAK,CAAC,IAAI,CAAC,CAAC,mBAAS,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;QAEpD,MAAM,iBAAiB,GAAG,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,QAAQ,EAAE;YACjB,iBAAiB,CAAC,IAAI,CAAC,mBAAS,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC,CAAC;SAC3E;QAED,IAAI,MAAM,CAAC,MAAM,EAAE;YACf,iBAAiB,CAAC,IAAI,CAAC,mBAAS,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC,CAAC;SAC1E;QAED,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9B,eAAe,GAAG;gBACd,GAAG,eAAe;gBAClB,CAAC,cAAE,CAAC,GAAG,CAAC,EAAE,iBAAiB;aAC9B,CAAC;SACL;QAED,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;IACtC,CAAC;IAED,MAAM,CAAC,EAAO;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;CACJ;AAhFD,gDAgFC"}
|
|
@@ -6,5 +6,10 @@ const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
|
|
|
6
6
|
class PotholeModel extends AlertDto_1.AlertDto {
|
|
7
7
|
}
|
|
8
8
|
exports.PotholeModel = PotholeModel;
|
|
9
|
-
PotholeModel.attributeModel =
|
|
9
|
+
PotholeModel.attributeModel = {
|
|
10
|
+
...AlertDto_1.AlertDto.attributeModel,
|
|
11
|
+
road_type_name: { type: sequelize_1.DataTypes.TEXT },
|
|
12
|
+
published_at: { type: sequelize_1.DataTypes.DATE, allowNull: false },
|
|
13
|
+
last_reported: { type: sequelize_1.DataTypes.DATE, allowNull: false },
|
|
14
|
+
};
|
|
10
15
|
//# sourceMappingURL=PotholeModel.js.map
|
|
@@ -1 +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,
|
|
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,GAAG;IAC3B,GAAG,mBAAQ,CAAC,cAAc;IAC1B,cAAc,EAAE,EAAE,IAAI,EAAE,qBAAS,CAAC,IAAI,EAAE;IACxC,YAAY,EAAE,EAAE,IAAI,EAAE,qBAAS,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE;IACxD,aAAa,EAAE,EAAE,IAAI,EAAE,qBAAS,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE;CAC5D,CAAC"}
|
|
@@ -5,6 +5,8 @@ export declare class PotHolesRouter extends AbstractRouter {
|
|
|
5
5
|
protected cacheHeaderMiddleware: CacheHeaderMiddleware;
|
|
6
6
|
constructor();
|
|
7
7
|
protected initRoutes(): void;
|
|
8
|
+
private getAll;
|
|
9
|
+
private parseParams;
|
|
8
10
|
}
|
|
9
11
|
declare const v1PotHolesRouter: AbstractRouter;
|
|
10
12
|
export { v1PotHolesRouter };
|
|
@@ -12,20 +12,48 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.v1PotHolesRouter = exports.PotHolesRouter = void 0;
|
|
13
13
|
const Di_1 = require("../ioc/Di");
|
|
14
14
|
const ModuleContainerToken_1 = require("../ioc/ModuleContainerToken");
|
|
15
|
+
const DateTime_1 = require("@golemio/core/dist/helpers/DateTime");
|
|
15
16
|
const AbstractRouter_1 = require("@golemio/core/dist/helpers/routing/AbstractRouter");
|
|
16
17
|
const Validation_1 = require("@golemio/core/dist/output-gateway/Validation");
|
|
17
18
|
const ioc_1 = require("@golemio/core/dist/output-gateway/ioc");
|
|
18
19
|
const express_validator_1 = require("@golemio/core/dist/shared/express-validator");
|
|
20
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
19
21
|
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
22
|
+
const PotholesController_1 = require("../controllers/PotholesController");
|
|
20
23
|
let PotHolesRouter = exports.PotHolesRouter = class PotHolesRouter extends AbstractRouter_1.AbstractRouter {
|
|
21
24
|
constructor() {
|
|
22
25
|
super("v1", "potholes");
|
|
26
|
+
this.getAll = async (req, res, next) => {
|
|
27
|
+
try {
|
|
28
|
+
const params = await this.parseParams(req);
|
|
29
|
+
const transformedResult = await this.controller.getAll(params);
|
|
30
|
+
res.json(transformedResult);
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
next(err);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
this.parseParams = async (req) => {
|
|
37
|
+
try {
|
|
38
|
+
const queryData = (0, express_validator_1.matchedData)(req);
|
|
39
|
+
const result = {
|
|
40
|
+
limit: queryData.limit ? Number(queryData.limit) : undefined,
|
|
41
|
+
offset: queryData.offset ? Number(queryData.offset) : undefined,
|
|
42
|
+
dateFrom: queryData.from ? queryData.from : (0, DateTime_1.dateTime)(new Date()).subtract(7, "days").toISOString(),
|
|
43
|
+
dateTo: queryData.to ? queryData.to : new Date().toISOString(),
|
|
44
|
+
};
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
throw new golemio_errors_1.GeneralError("Param parsing error", PotholesController_1.PotholesController.name, error, 500);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
23
51
|
this.controller = Di_1.PotHolesContainer.resolve(ModuleContainerToken_1.ModuleContainerToken.PotholesController);
|
|
24
52
|
this.cacheHeaderMiddleware = Di_1.PotHolesContainer.resolve(ioc_1.ContainerToken.CacheHeaderMiddleware);
|
|
25
53
|
this.initRoutes();
|
|
26
54
|
}
|
|
27
55
|
initRoutes() {
|
|
28
|
-
this.router.get("/data", [(0, express_validator_1.query)("from").optional().isISO8601().not().isArray(), (0, express_validator_1.query)("to").optional().isISO8601().not().isArray()],
|
|
56
|
+
this.router.get("/data", [(0, express_validator_1.query)("from").optional().isISO8601().not().isArray(), (0, express_validator_1.query)("to").optional().isISO8601().not().isArray()], (0, Validation_1.paginationLimitMiddleware)(this.path), Validation_1.checkErrors, this.cacheHeaderMiddleware.getMiddleware(3 * 60, 60), this.getAll);
|
|
29
57
|
}
|
|
30
58
|
};
|
|
31
59
|
exports.PotHolesRouter = PotHolesRouter = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PotHolesRouter.js","sourceRoot":"","sources":["../../../src/output-gateway/routers/PotHolesRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,kCAA+C;AAC/C,sEAAoE;AACpE,sFAAmF;AAEnF,
|
|
1
|
+
{"version":3,"file":"PotHolesRouter.js","sourceRoot":"","sources":["../../../src/output-gateway/routers/PotHolesRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,kCAA+C;AAC/C,sEAAoE;AACpE,kEAA+D;AAC/D,sFAAmF;AAEnF,6EAAsG;AACtG,+DAAuE;AAEvE,mFAAiF;AACjF,6EAAwE;AACxE,iEAAgE;AAChE,0EAAuE;AAIhE,IAAM,cAAc,4BAApB,MAAM,cAAe,SAAQ,+BAAc;IAI9C;QACI,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAiBpB,WAAM,GAAG,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE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CAAC,CAAC;QA1CE,IAAI,CAAC,UAAU,GAAG,sBAAiB,CAAC,OAAO,CAAsB,2CAAoB,CAAC,kBAAkB,CAAC,CAAC;QAC1G,IAAI,CAAC,qBAAqB,GAAG,sBAAiB,CAAC,OAAO,CAAwB,oBAAc,CAAC,qBAAqB,CAAC,CAAC;QACpH,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;IAES,UAAU;QAChB,IAAI,CAAC,MAAM,CAAC,GAAG,CACX,OAAO,EACP,CAAC,IAAA,yBAAK,EAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,IAAA,yBAAK,EAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,EAC1G,IAAA,sCAAyB,EAAC,IAAI,CAAC,IAAI,CAAC,EACpC,wBAAW,EACX,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EACpD,IAAI,CAAC,MAAM,CACd,CAAC;IACN,CAAC;CA6BJ,CAAA;yBAjDY,cAAc;IAD1B,IAAA,qBAAU,GAAE;;GACA,cAAc,CAiD1B;AAED,MAAM,gBAAgB,GAAmB,IAAI,cAAc,EAAE,CAAC;AAErD,4CAAgB"}
|
|
@@ -15,21 +15,20 @@ let PotholesTransformation = exports.PotholesTransformation = class PotholesTran
|
|
|
15
15
|
super(...arguments);
|
|
16
16
|
this.name = "PotholesTransformation";
|
|
17
17
|
this.transformInternal = (element) => {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
19
18
|
const properties = {
|
|
20
19
|
uuid: element.uuid,
|
|
21
|
-
city:
|
|
22
|
-
street:
|
|
23
|
-
road_type:
|
|
24
|
-
event_direction:
|
|
20
|
+
city: element.city ?? null,
|
|
21
|
+
street: element.street ?? null,
|
|
22
|
+
road_type: element.road_type_name ?? null,
|
|
23
|
+
event_direction: element.magvar ?? null,
|
|
25
24
|
published_at: element.published_at,
|
|
26
25
|
valid_from: element.valid_from,
|
|
27
26
|
last_reported_at: element.last_reported,
|
|
28
|
-
reliability:
|
|
29
|
-
confidence:
|
|
30
|
-
duplicate_count:
|
|
27
|
+
reliability: element.reliability ?? null,
|
|
28
|
+
confidence: element.confidence ?? null,
|
|
29
|
+
duplicate_count: element.duplicate_count ?? null,
|
|
31
30
|
};
|
|
32
|
-
return (0, output_gateway_1.buildGeojsonFeature)(
|
|
31
|
+
return (0, output_gateway_1.buildGeojsonFeature)({ ...properties, lon: element.location.x, lat: element.location.y }, "lon", "lat", true);
|
|
33
32
|
};
|
|
34
33
|
}
|
|
35
34
|
};
|
|
@@ -1 +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
|
|
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,OAAO,CAAC,IAAI,IAAI,IAAI;gBAC1B,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,IAAI;gBAC9B,SAAS,EAAE,OAAO,CAAC,cAAc,IAAI,IAAI;gBACzC,eAAe,EAAE,OAAO,CAAC,MAAM,IAAI,IAAI;gBACvC,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,gBAAgB,EAAE,OAAO,CAAC,aAAa;gBACvC,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,IAAI;gBACxC,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI;gBACtC,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,IAAI;aACnD,CAAC;YAEF,OAAO,IAAA,oCAAmB,EAAC,EAAE,GAAG,UAAU,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACxH,CAAC,CAAC;IACN,CAAC;CAAA,CAAA;iCApBY,sBAAsB;IADlC,IAAA,qBAAU,GAAE;GACA,sBAAsB,CAoBlC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golemio/waze-ccp",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6-dev.2085875023",
|
|
4
4
|
"description": "Golemio Waze CCP Module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@commitlint/cli": "^11.0.0",
|
|
37
37
|
"@commitlint/config-conventional": "^11.0.0",
|
|
38
38
|
"@golemio/cli": "1.7.3",
|
|
39
|
-
"@golemio/core": "1.
|
|
39
|
+
"@golemio/core": "1.22.2-dev.2083548346",
|
|
40
40
|
"@golemio/db-common": "1.1.4",
|
|
41
41
|
"@golemio/eslint-config": "1.1.2",
|
|
42
42
|
"@types/chai": "4.2.3",
|