@golemio/pid 2.2.11-dev.626273033 → 2.2.12-dev.633184780
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_truncate_tables.sql → 00_clear_test_data.sql} +9 -0
- package/db/example/05_vehicle_positions_dump.sql +2 -2
- package/db/example/11_ropidgtfs_stops_with_node.sql +9 -9
- package/db/example/12_metro_runs_messages.sql +5 -0
- package/db/migrations/postgresql/20220830144637-metro-runs-messages.js +53 -0
- package/db/migrations/postgresql/sqls/20220830144637-metro-runs-messages-down.sql +1 -0
- package/db/migrations/postgresql/sqls/20220830144637-metro-runs-messages-up.sql +27 -0
- package/dist/integration-engine/index.d.ts +2 -0
- package/dist/integration-engine/index.js +3 -1
- package/dist/integration-engine/index.js.map +1 -1
- package/dist/integration-engine/queueDefinitions.d.ts +3 -0
- package/dist/integration-engine/queueDefinitions.js +3 -0
- package/dist/integration-engine/queueDefinitions.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/VehiclePositionsWorker.d.ts +4 -4
- package/dist/integration-engine/vehicle-positions/VehiclePositionsWorker.js +5 -4
- package/dist/integration-engine/vehicle-positions/VehiclePositionsWorker.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/data-access/MetroRunsMessagesRepository.d.ts +7 -0
- package/dist/integration-engine/vehicle-positions/data-access/MetroRunsMessagesRepository.js +81 -0
- package/dist/integration-engine/vehicle-positions/data-access/MetroRunsMessagesRepository.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/data-access/index.d.ts +1 -0
- package/dist/integration-engine/vehicle-positions/data-access/index.js +18 -0
- package/dist/integration-engine/vehicle-positions/data-access/index.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/schema/DataDeletionSchema.d.ts +6 -0
- package/dist/integration-engine/vehicle-positions/schema/DataDeletionSchema.js +22 -0
- package/dist/integration-engine/vehicle-positions/schema/DataDeletionSchema.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/schema/MetroRunsSchema.d.ts +4 -0
- package/dist/integration-engine/vehicle-positions/schema/MetroRunsSchema.js +84 -0
- package/dist/integration-engine/vehicle-positions/schema/MetroRunsSchema.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/schema/MetroRunsSchemaInterfaces.d.ts +22 -0
- package/dist/integration-engine/vehicle-positions/schema/MetroRunsSchemaInterfaces.js +3 -0
- package/dist/integration-engine/vehicle-positions/schema/MetroRunsSchemaInterfaces.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/schema/index.d.ts +3 -0
- package/dist/integration-engine/vehicle-positions/schema/index.js +20 -0
- package/dist/integration-engine/vehicle-positions/schema/index.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/transformations/MetroRunsMessagesTransformation.d.ts +6 -0
- package/dist/integration-engine/vehicle-positions/transformations/MetroRunsMessagesTransformation.js +37 -0
- package/dist/integration-engine/vehicle-positions/transformations/MetroRunsMessagesTransformation.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/transformations/index.d.ts +1 -0
- package/dist/integration-engine/vehicle-positions/transformations/index.js +1 -0
- package/dist/integration-engine/vehicle-positions/transformations/index.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/RunsWorker.d.ts +5 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/RunsWorker.js +18 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/RunsWorker.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/DeleteDataTask.d.ts +10 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/DeleteDataTask.js +31 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/DeleteDataTask.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveMetroRunsToDBTask.d.ts +10 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveMetroRunsToDBTask.js +33 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveMetroRunsToDBTask.js.map +1 -0
- package/dist/output-gateway/pid/dto/DepartureBoardsDTO.d.ts +1 -1
- package/dist/output-gateway/ropid-gtfs/models/GTFSStopModel.d.ts +3 -28
- package/dist/output-gateway/ropid-gtfs/models/GTFSStopModel.js +65 -56
- package/dist/output-gateway/ropid-gtfs/models/GTFSStopModel.js.map +1 -1
- package/dist/output-gateway/ropid-gtfs/models/GTFSStopModelInterfaces.d.ts +36 -0
- package/dist/output-gateway/ropid-gtfs/models/GTFSStopModelInterfaces.js +3 -0
- package/dist/output-gateway/ropid-gtfs/models/GTFSStopModelInterfaces.js.map +1 -0
- package/dist/output-gateway/shared/index.d.ts +0 -1
- package/dist/output-gateway/shared/index.js +0 -1
- package/dist/output-gateway/shared/index.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/RopidGtfsSchedule.d.ts +35 -10
- package/dist/schema-definitions/ropid-gtfs/RopidGtfsSchedule.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/index.d.ts +35 -11
- package/dist/schema-definitions/vehicle-positions/models/MetroRunsMessagesModel.d.ts +17 -0
- package/dist/schema-definitions/vehicle-positions/models/MetroRunsMessagesModel.js +90 -0
- package/dist/schema-definitions/vehicle-positions/models/MetroRunsMessagesModel.js.map +1 -0
- package/dist/schema-definitions/vehicle-positions/models/index.d.ts +1 -0
- package/dist/schema-definitions/vehicle-positions/models/index.js +18 -0
- package/dist/schema-definitions/vehicle-positions/models/index.js.map +1 -0
- package/dist/schema-definitions/vehicle-positions/models/interfaces/IMetroRunsMessagesModel.d.ts +10 -0
- package/dist/schema-definitions/vehicle-positions/models/interfaces/IMetroRunsMessagesModel.js +3 -0
- package/dist/schema-definitions/vehicle-positions/models/interfaces/IMetroRunsMessagesModel.js.map +1 -0
- package/package.json +4 -3
- package/dist/output-gateway/shared/QueryGenerator.d.ts +0 -10
- package/dist/output-gateway/shared/QueryGenerator.js +0 -20
- package/dist/output-gateway/shared/QueryGenerator.js.map +0 -1
|
@@ -0,0 +1,84 @@
|
|
|
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.MetroRunsValidationSchema = void 0;
|
|
13
|
+
const class_validator_1 = require("@golemio/core/dist/shared/class-validator");
|
|
14
|
+
const class_transformer_1 = require("@golemio/core/dist/shared/class-transformer");
|
|
15
|
+
class MessagePropertiesValidationSchema {
|
|
16
|
+
}
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsString)(),
|
|
19
|
+
(0, class_validator_1.IsByteLength)(1, 1),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], MessagePropertiesValidationSchema.prototype, "linka", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_validator_1.IsISO8601)({ strict: true }),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], MessagePropertiesValidationSchema.prototype, "tm", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, class_validator_1.IsOptional)(),
|
|
28
|
+
(0, class_validator_1.IsString)(),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], MessagePropertiesValidationSchema.prototype, "gvd", void 0);
|
|
31
|
+
class TrainPropertiesValidationSchema {
|
|
32
|
+
}
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, class_validator_1.IsString)(),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], TrainPropertiesValidationSchema.prototype, "csp", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, class_validator_1.IsString)(),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], TrainPropertiesValidationSchema.prototype, "csr", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, class_validator_1.IsString)(),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], TrainPropertiesValidationSchema.prototype, "cv", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_validator_1.IsString)(),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], TrainPropertiesValidationSchema.prototype, "ko", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, class_validator_1.IsNumberString)(),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], TrainPropertiesValidationSchema.prototype, "odch", void 0);
|
|
53
|
+
class TrainContentValidationSchema {
|
|
54
|
+
}
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, class_validator_1.IsObject)(),
|
|
57
|
+
(0, class_validator_1.ValidateNested)(),
|
|
58
|
+
(0, class_transformer_1.Type)(() => TrainPropertiesValidationSchema),
|
|
59
|
+
__metadata("design:type", Object)
|
|
60
|
+
], TrainContentValidationSchema.prototype, "$", void 0);
|
|
61
|
+
class MessageContentValidationSchema {
|
|
62
|
+
}
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, class_validator_1.IsObject)(),
|
|
65
|
+
(0, class_validator_1.ValidateNested)(),
|
|
66
|
+
(0, class_transformer_1.Type)(() => MessagePropertiesValidationSchema),
|
|
67
|
+
__metadata("design:type", Object)
|
|
68
|
+
], MessageContentValidationSchema.prototype, "$", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, class_validator_1.IsObject)({ each: true }),
|
|
71
|
+
(0, class_validator_1.ValidateNested)(),
|
|
72
|
+
(0, class_transformer_1.Type)(() => TrainContentValidationSchema),
|
|
73
|
+
__metadata("design:type", Object)
|
|
74
|
+
], MessageContentValidationSchema.prototype, "vlak", void 0);
|
|
75
|
+
class MetroRunsValidationSchema {
|
|
76
|
+
}
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, class_validator_1.IsObject)(),
|
|
79
|
+
(0, class_validator_1.ValidateNested)(),
|
|
80
|
+
(0, class_transformer_1.Type)(() => MessageContentValidationSchema),
|
|
81
|
+
__metadata("design:type", Object)
|
|
82
|
+
], MetroRunsValidationSchema.prototype, "m", void 0);
|
|
83
|
+
exports.MetroRunsValidationSchema = MetroRunsValidationSchema;
|
|
84
|
+
//# sourceMappingURL=MetroRunsSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetroRunsSchema.js","sourceRoot":"","sources":["../../../../src/integration-engine/vehicle-positions/schema/MetroRunsSchema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+EAQmD;AACnD,mFAAmE;AASnE,MAAM,iCAAiC;CAWtC;AARG;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,8BAAY,EAAC,CAAC,EAAE,CAAC,CAAC;;gEACJ;AAGf;IADC,IAAA,2BAAS,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;6DAChB;AAIZ;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;8DACE;AAGjB,MAAM,+BAA+B;CAepC;AAbG;IADC,IAAA,0BAAQ,GAAE;;4DACE;AAGb;IADC,IAAA,0BAAQ,GAAE;;4DACE;AAGb;IADC,IAAA,0BAAQ,GAAE;;2DACC;AAGZ;IADC,IAAA,0BAAQ,GAAE;;2DACC;AAGZ;IADC,IAAA,gCAAc,GAAE;;6DACH;AAGlB,MAAM,4BAA4B;CAKjC;AADG;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,+BAA+B,CAAC;;uDACd;AAGlC,MAAM,8BAA8B;CAUnC;AANG;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,iCAAiC,CAAC;;yDACd;AAKhC;IAHC,IAAA,0BAAQ,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACxB,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,4BAA4B,CAAC;;4DACgB;AAG7D,MAAa,yBAAyB;CAKrC;AADG;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,8BAA8B,CAAC;;oDACd;AAJjC,8DAKC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface IMetroRunsMessageProperties {
|
|
2
|
+
linka: string;
|
|
3
|
+
tm: string;
|
|
4
|
+
gvd?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IMetroRunsTrainProperties {
|
|
7
|
+
csp: string;
|
|
8
|
+
csr: string;
|
|
9
|
+
cv: string;
|
|
10
|
+
ko: string;
|
|
11
|
+
odch: string;
|
|
12
|
+
}
|
|
13
|
+
export interface IMetroRunsTrainContent {
|
|
14
|
+
$: IMetroRunsTrainProperties;
|
|
15
|
+
}
|
|
16
|
+
export interface IMetroRunsMessageContent {
|
|
17
|
+
$: IMetroRunsMessageProperties;
|
|
18
|
+
vlak: IMetroRunsTrainContent | IMetroRunsTrainContent[];
|
|
19
|
+
}
|
|
20
|
+
export interface IMetroRunsInput {
|
|
21
|
+
m: IMetroRunsMessageContent;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetroRunsSchemaInterfaces.js","sourceRoot":"","sources":["../../../../src/integration-engine/vehicle-positions/schema/MetroRunsSchemaInterfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
__exportStar(require("./MetroRunsSchema"), exports);
|
|
18
|
+
__exportStar(require("./MetroRunsSchemaInterfaces"), exports);
|
|
19
|
+
__exportStar(require("./DataDeletionSchema"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/integration-engine/vehicle-positions/schema/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,8DAA4C;AAC5C,uDAAqC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MetroRunsMessagesModel } from "../../../schema-definitions/vehicle-positions/models";
|
|
2
|
+
import { IMetroRunsInput } from "../schema";
|
|
3
|
+
export declare class MetroRunsMessagesTransformation {
|
|
4
|
+
static mapToDTO: (data: IMetroRunsInput) => MetroRunsMessagesModel[];
|
|
5
|
+
private static mapItemToDTO;
|
|
6
|
+
}
|
package/dist/integration-engine/vehicle-positions/transformations/MetroRunsMessagesTransformation.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.MetroRunsMessagesTransformation = void 0;
|
|
5
|
+
class MetroRunsMessagesTransformation {
|
|
6
|
+
}
|
|
7
|
+
exports.MetroRunsMessagesTransformation = MetroRunsMessagesTransformation;
|
|
8
|
+
_a = MetroRunsMessagesTransformation;
|
|
9
|
+
MetroRunsMessagesTransformation.mapToDTO = (data) => {
|
|
10
|
+
let { $: messageData, vlak: trainData } = data.m;
|
|
11
|
+
const dto = [];
|
|
12
|
+
if (!Array.isArray(trainData)) {
|
|
13
|
+
trainData = [trainData];
|
|
14
|
+
}
|
|
15
|
+
for (const trainDataItem of trainData) {
|
|
16
|
+
const dtoItem = _a.mapItemToDTO({ messageData, trainData: trainDataItem });
|
|
17
|
+
dto.push(dtoItem);
|
|
18
|
+
}
|
|
19
|
+
return dto;
|
|
20
|
+
};
|
|
21
|
+
MetroRunsMessagesTransformation.mapItemToDTO = ({ messageData, trainData }) => {
|
|
22
|
+
const delayOrigin = parseInt(trainData.$.odch);
|
|
23
|
+
const messageTimestamp = new Date(messageData.tm).getTime();
|
|
24
|
+
// delay is in seconds, positive number means the train is ahead of time
|
|
25
|
+
const scheduledTimestamp = messageTimestamp + delayOrigin * 1000;
|
|
26
|
+
return {
|
|
27
|
+
route_name: messageData.linka,
|
|
28
|
+
message_timestamp: messageData.tm,
|
|
29
|
+
train_set_number_scheduled: trainData.$.csp.trimStart(),
|
|
30
|
+
train_set_number_real: trainData.$.csr.trimStart(),
|
|
31
|
+
train_number: trainData.$.cv,
|
|
32
|
+
track_id: trainData.$.ko,
|
|
33
|
+
delay_origin: delayOrigin,
|
|
34
|
+
actual_position_timestamp_scheduled: scheduledTimestamp,
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=MetroRunsMessagesTransformation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetroRunsMessagesTransformation.js","sourceRoot":"","sources":["../../../../src/integration-engine/vehicle-positions/transformations/MetroRunsMessagesTransformation.ts"],"names":[],"mappings":";;;;AAQA,MAAa,+BAA+B;;AAA5C,0EAkCC;;AAjCiB,wCAAQ,GAAG,CAAC,IAAqB,EAA4B,EAAE;IACzE,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;IACjD,MAAM,GAAG,GAA6B,EAAE,CAAC;IAEzC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;QAC3B,SAAS,GAAG,CAAC,SAAS,CAAC,CAAC;KAC3B;IAED,KAAK,MAAM,aAAa,IAAI,SAAS,EAAE;QACnC,MAAM,OAAO,GAAG,EAAI,CAAC,YAAY,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;QAC7E,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACrB;IAED,OAAO,GAAG,CAAC;AACf,CAAE,CAAA;AAEa,4CAAY,GAAG,CAAC,EAAE,WAAW,EAAE,SAAS,EAAoB,EAA0B,EAAE;IACnG,MAAM,WAAW,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,gBAAgB,GAAG,IAAI,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IAC5D,wEAAwE;IACxE,MAAM,kBAAkB,GAAG,gBAAgB,GAAG,WAAW,GAAG,IAAI,CAAC;IAEjE,OAAO;QACH,UAAU,EAAE,WAAW,CAAC,KAAK;QAC7B,iBAAiB,EAAE,WAAW,CAAC,EAAE;QACjC,0BAA0B,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE;QACvD,qBAAqB,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE;QAClD,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE;QAC5B,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE;QACxB,YAAY,EAAE,WAAW;QACzB,mCAAmC,EAAE,kBAAkB;KAChC,CAAC;AAChC,CAAE,CAAA"}
|
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./VehiclePositionsRunsTransformation"), exports);
|
|
18
18
|
__exportStar(require("./VehiclePositionsTransformation"), exports);
|
|
19
|
+
__exportStar(require("./MetroRunsMessagesTransformation"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/integration-engine/vehicle-positions/transformations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uEAAqD;AACrD,mEAAiD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/integration-engine/vehicle-positions/transformations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uEAAqD;AACrD,mEAAiD;AACjD,oEAAkD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RunsWorker = void 0;
|
|
4
|
+
const workers_1 = require("@golemio/core/dist/integration-engine/workers");
|
|
5
|
+
const vehicle_positions_1 = require("../../../../schema-definitions/vehicle-positions");
|
|
6
|
+
const SaveMetroRunsToDBTask_1 = require("./tasks/SaveMetroRunsToDBTask");
|
|
7
|
+
const DeleteDataTask_1 = require("./tasks/DeleteDataTask");
|
|
8
|
+
class RunsWorker extends workers_1.AbstractWorker {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.name = vehicle_positions_1.VehiclePositions.name + "Runs";
|
|
12
|
+
// Register tasks
|
|
13
|
+
this.registerTask(new SaveMetroRunsToDBTask_1.SaveMetroRunsToDBTask(this.getQueuePrefix()));
|
|
14
|
+
this.registerTask(new DeleteDataTask_1.DeleteDataTask(this.getQueuePrefix()));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.RunsWorker = RunsWorker;
|
|
18
|
+
//# sourceMappingURL=RunsWorker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RunsWorker.js","sourceRoot":"","sources":["../../../../../src/integration-engine/vehicle-positions/workers/runs/RunsWorker.ts"],"names":[],"mappings":";;;AAAA,2EAA+E;AAC/E,wFAA0D;AAC1D,yEAAsE;AACtE,2DAAwD;AAExD,MAAa,UAAW,SAAQ,wBAAc;IAG1C;QACI,KAAK,EAAE,CAAC;QAHF,SAAI,GAAG,oCAAgB,CAAC,IAAI,GAAG,MAAM,CAAC;QAK5C,iBAAiB;QACjB,IAAI,CAAC,YAAY,CAAC,IAAI,6CAAqB,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;QACpE,IAAI,CAAC,YAAY,CAAC,IAAI,+BAAc,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;IACjE,CAAC;CACJ;AAVD,gCAUC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AbstractTask } from "@golemio/core/dist/integration-engine/workers";
|
|
2
|
+
import { IDataDeletionParams, DataDeletionValidationSchema } from "../../../schema";
|
|
3
|
+
export declare class DeleteDataTask extends AbstractTask<IDataDeletionParams> {
|
|
4
|
+
readonly queueName = "deleteData";
|
|
5
|
+
readonly queueTtl: number;
|
|
6
|
+
readonly schema: typeof DataDeletionValidationSchema;
|
|
7
|
+
private readonly messagesRepository;
|
|
8
|
+
constructor(queuePrefix: string);
|
|
9
|
+
protected execute(data: IDataDeletionParams): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DeleteDataTask = void 0;
|
|
13
|
+
const workers_1 = require("@golemio/core/dist/integration-engine/workers");
|
|
14
|
+
const schema_1 = require("../../../schema");
|
|
15
|
+
const data_access_1 = require("../../../data-access");
|
|
16
|
+
class DeleteDataTask extends workers_1.AbstractTask {
|
|
17
|
+
constructor(queuePrefix) {
|
|
18
|
+
super(queuePrefix);
|
|
19
|
+
this.queueName = "deleteData";
|
|
20
|
+
this.queueTtl = 1 * 60 * 60 * 1000; // 1 hour
|
|
21
|
+
this.schema = schema_1.DataDeletionValidationSchema;
|
|
22
|
+
this.messagesRepository = new data_access_1.MetroRunsMessagesRepository();
|
|
23
|
+
}
|
|
24
|
+
execute(data) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
yield this.messagesRepository.deleteNHoursOldData(data.targetHours);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.DeleteDataTask = DeleteDataTask;
|
|
31
|
+
//# sourceMappingURL=DeleteDataTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeleteDataTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/tasks/DeleteDataTask.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2EAA6E;AAC7E,4CAAiG;AACjG,sDAAgF;AAEhF,MAAa,cAAe,SAAQ,sBAAiC;IAOjE,YAAY,WAAmB;QAC3B,KAAK,CAAC,WAAW,CAAC,CAAC;QAPP,cAAS,GAAG,YAAY,CAAC;QACzB,aAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,SAAS;QACxC,WAAM,GAAG,qCAA4B,CAAC;QAMlD,IAAI,CAAC,kBAAkB,GAAG,IAAI,yCAA2B,EAAE,CAAC;IAChE,CAAC;IAEe,OAAO,CAAC,IAAyB;;YAC7C,MAAM,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACxE,CAAC;KAAA;CACJ;AAfD,wCAeC"}
|
package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveMetroRunsToDBTask.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AbstractTask } from "@golemio/core/dist/integration-engine/workers";
|
|
2
|
+
import { IMetroRunsInput, MetroRunsValidationSchema } from "../../../schema";
|
|
3
|
+
export declare class SaveMetroRunsToDBTask extends AbstractTask<IMetroRunsInput> {
|
|
4
|
+
readonly queueName = "saveMetroRunsToDB";
|
|
5
|
+
readonly queueTtl: number;
|
|
6
|
+
readonly schema: typeof MetroRunsValidationSchema;
|
|
7
|
+
private readonly messagesRepository;
|
|
8
|
+
constructor(queuePrefix: string);
|
|
9
|
+
protected execute(data: IMetroRunsInput): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SaveMetroRunsToDBTask = void 0;
|
|
13
|
+
const workers_1 = require("@golemio/core/dist/integration-engine/workers");
|
|
14
|
+
const schema_1 = require("../../../schema");
|
|
15
|
+
const transformations_1 = require("../../../transformations");
|
|
16
|
+
const data_access_1 = require("../../../data-access");
|
|
17
|
+
class SaveMetroRunsToDBTask extends workers_1.AbstractTask {
|
|
18
|
+
constructor(queuePrefix) {
|
|
19
|
+
super(queuePrefix);
|
|
20
|
+
this.queueName = "saveMetroRunsToDB";
|
|
21
|
+
this.queueTtl = 3 * 60 * 1000; // 3 minutes
|
|
22
|
+
this.schema = schema_1.MetroRunsValidationSchema;
|
|
23
|
+
this.messagesRepository = new data_access_1.MetroRunsMessagesRepository();
|
|
24
|
+
}
|
|
25
|
+
execute(data) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const messages = transformations_1.MetroRunsMessagesTransformation.mapToDTO(data);
|
|
28
|
+
yield this.messagesRepository.saveData(messages);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.SaveMetroRunsToDBTask = SaveMetroRunsToDBTask;
|
|
33
|
+
//# sourceMappingURL=SaveMetroRunsToDBTask.js.map
|
package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveMetroRunsToDBTask.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SaveMetroRunsToDBTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/tasks/SaveMetroRunsToDBTask.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2EAA6E;AAC7E,4CAA0F;AAC1F,8DAAwF;AACxF,sDAAgF;AAEhF,MAAa,qBAAsB,SAAQ,sBAA6B;IAOpE,YAAY,WAAmB;QAC3B,KAAK,CAAC,WAAW,CAAC,CAAC;QAPP,cAAS,GAAG,mBAAmB,CAAC;QAChC,aAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;QACtC,WAAM,GAAG,kCAAyB,CAAC;QAM/C,IAAI,CAAC,kBAAkB,GAAG,IAAI,yCAA2B,EAAE,CAAC;IAChE,CAAC;IAEe,OAAO,CAAC,IAAqB;;YACzC,MAAM,QAAQ,GAAG,iDAA+B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAChE,MAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrD,CAAC;KAAA;CACJ;AAhBD,sDAgBC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IGTFSStopGetAllOutput } from "../../ropid-gtfs/models/
|
|
1
|
+
import { IGTFSStopGetAllOutput } from "../../ropid-gtfs/models/GTFSStopModelInterfaces";
|
|
2
2
|
import { IInfotextsStopsWithEventOutputModel } from "../models/RopidVYMIEventsStopsModel";
|
|
3
3
|
import { IPIDDepartureOutput } from "./..";
|
|
4
4
|
export declare class DepartureBoardsQueryDTO {
|
|
@@ -1,32 +1,11 @@
|
|
|
1
1
|
import { IGeoJSONFeatureCollection, IGeoJSONFeature } from "@golemio/core/dist/output-gateway/Geo";
|
|
2
2
|
import { SequelizeModel } from "@golemio/core/dist/output-gateway/models";
|
|
3
|
-
import {
|
|
4
|
-
declare type AswID = {
|
|
5
|
-
node: number;
|
|
6
|
-
stop: number;
|
|
7
|
-
};
|
|
8
|
-
declare type GetAllOptions<T extends boolean = false> = {
|
|
9
|
-
limit?: number;
|
|
10
|
-
offset?: number;
|
|
11
|
-
lat?: number;
|
|
12
|
-
lng?: number;
|
|
13
|
-
range?: number;
|
|
14
|
-
names?: string[];
|
|
15
|
-
gtfsIds?: string[];
|
|
16
|
-
aswIds?: string[];
|
|
17
|
-
cisIds?: string[];
|
|
18
|
-
locationType?: number;
|
|
19
|
-
includeMetroTrains?: boolean;
|
|
20
|
-
appendAswId?: boolean;
|
|
21
|
-
returnRaw?: T;
|
|
22
|
-
};
|
|
23
|
-
export interface IGTFSStopGetAllOutput extends IRopidGTFSStopsOutput {
|
|
24
|
-
asw_id?: AswID | null;
|
|
25
|
-
}
|
|
3
|
+
import { IGTFSStopGetAllOutput, GetAllOptions } from "./GTFSStopModelInterfaces";
|
|
26
4
|
export declare class GTFSStopModel extends SequelizeModel {
|
|
27
5
|
private readonly outputAttributes;
|
|
28
6
|
private cisStopsModel;
|
|
29
7
|
constructor();
|
|
8
|
+
Associate: () => void;
|
|
30
9
|
/**
|
|
31
10
|
* Retrieve all gtfs stops
|
|
32
11
|
*/
|
|
@@ -36,9 +15,5 @@ export declare class GTFSStopModel extends SequelizeModel {
|
|
|
36
15
|
*/
|
|
37
16
|
GetOne: (id: string) => Promise<IGeoJSONFeature | null>;
|
|
38
17
|
private prepareCisStops;
|
|
39
|
-
|
|
40
|
-
* Parse stop ASW id from GTFS id
|
|
41
|
-
*/
|
|
42
|
-
private parseAswId;
|
|
18
|
+
private prepareFindOptionsForMetro;
|
|
43
19
|
}
|
|
44
|
-
export {};
|
|
@@ -18,7 +18,6 @@ const sequelize_1 = __importDefault(require("@golemio/core/dist/shared/sequelize
|
|
|
18
18
|
const database_1 = require("@golemio/core/dist/output-gateway/database");
|
|
19
19
|
const Geo_1 = require("@golemio/core/dist/output-gateway/Geo");
|
|
20
20
|
const models_1 = require("@golemio/core/dist/output-gateway/models");
|
|
21
|
-
const shared_1 = require("../../shared");
|
|
22
21
|
const ropid_gtfs_1 = require("../../../schema-definitions/ropid-gtfs");
|
|
23
22
|
class GTFSStopModel extends models_1.SequelizeModel {
|
|
24
23
|
constructor() {
|
|
@@ -26,6 +25,13 @@ class GTFSStopModel extends models_1.SequelizeModel {
|
|
|
26
25
|
schema: ropid_gtfs_1.RopidGTFS.pgSchema,
|
|
27
26
|
});
|
|
28
27
|
this.outputAttributes = [];
|
|
28
|
+
this.Associate = () => {
|
|
29
|
+
this.sequelizeModel.hasMany(this.sequelizeModel, {
|
|
30
|
+
as: "stops_self",
|
|
31
|
+
foreignKey: "asw_node_id",
|
|
32
|
+
sourceKey: "asw_node_id",
|
|
33
|
+
});
|
|
34
|
+
};
|
|
29
35
|
/**
|
|
30
36
|
* Retrieve specific gtfs stop
|
|
31
37
|
*/
|
|
@@ -70,35 +76,19 @@ class GTFSStopModel extends models_1.SequelizeModel {
|
|
|
70
76
|
});
|
|
71
77
|
return stops;
|
|
72
78
|
});
|
|
73
|
-
/**
|
|
74
|
-
* Parse stop ASW id from GTFS id
|
|
75
|
-
*/
|
|
76
|
-
this.parseAswId = (gtfsId) => {
|
|
77
|
-
const matches = gtfsId.match(/U(\d+)Z(\d+)/);
|
|
78
|
-
if (!matches)
|
|
79
|
-
return null;
|
|
80
|
-
return {
|
|
81
|
-
node: parseInt(matches[1], 10),
|
|
82
|
-
stop: parseInt(matches[2], 10),
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
79
|
this.outputAttributes = Object.keys(ropid_gtfs_1.RopidGTFS.stops.outputSequelizeAttributes);
|
|
86
80
|
const notUsedColumns = ["stop_code", "stop_desc", "stop_url", "stop_timezone", "asw_node_id", "asw_stop_id"];
|
|
87
|
-
notUsedColumns.forEach((column) => {
|
|
88
|
-
this.sequelizeModel.removeAttribute(column);
|
|
89
|
-
this.outputAttributes.splice(this.outputAttributes.indexOf(column), 1);
|
|
90
|
-
});
|
|
91
81
|
const auditColumns = ["created_by", "update_batch_id", "create_batch_id", "updated_by", "created_at", "updated_at"];
|
|
92
|
-
|
|
82
|
+
for (const column of notUsedColumns.concat(auditColumns)) {
|
|
93
83
|
this.sequelizeModel.removeAttribute(column);
|
|
94
84
|
this.outputAttributes.splice(this.outputAttributes.indexOf(column), 1);
|
|
95
|
-
}
|
|
85
|
+
}
|
|
96
86
|
this.cisStopsModel = database_1.sequelizeConnection.define(ropid_gtfs_1.RopidGTFS.cis_stops.pgTableName, ropid_gtfs_1.RopidGTFS.cis_stops.outputSequelizeAttributes, { schema: ropid_gtfs_1.RopidGTFS.pgSchema });
|
|
97
87
|
}
|
|
98
88
|
GetAll(options) {
|
|
99
|
-
var _a, _b, _c, _d, _e
|
|
89
|
+
var _a, _b, _c, _d, _e;
|
|
100
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
-
|
|
91
|
+
let attributes = [...this.outputAttributes];
|
|
102
92
|
let order = [];
|
|
103
93
|
let where = {};
|
|
104
94
|
let allGtfsIds = [];
|
|
@@ -127,13 +117,14 @@ class GTFSStopModel extends models_1.SequelizeModel {
|
|
|
127
117
|
const location = sequelize_1.default.literal(`ST_GeomFromText('POINT(${options.lng} ${options.lat})')`);
|
|
128
118
|
const distance = sequelize_1.default.fn("ST_DistanceSphere", sequelize_1.default.literal("ST_MakePoint(stop_lon, stop_lat)"), location);
|
|
129
119
|
attributes.push([distance, "distance"]);
|
|
130
|
-
order.push("distance ASC");
|
|
120
|
+
order.push(["distance", "ASC"]);
|
|
131
121
|
if (options.range) {
|
|
132
122
|
where.distance = {
|
|
133
123
|
[sequelize_1.default.Op.lte]: options.range,
|
|
134
124
|
};
|
|
135
125
|
}
|
|
136
126
|
}
|
|
127
|
+
order.push(["stop_id", "ASC"]);
|
|
137
128
|
for (const stop of (_d = options.gtfsIds) !== null && _d !== void 0 ? _d : []) {
|
|
138
129
|
allGtfsIds.push("(^" + stop + "$)");
|
|
139
130
|
}
|
|
@@ -148,51 +139,69 @@ class GTFSStopModel extends models_1.SequelizeModel {
|
|
|
148
139
|
if (options.locationType !== undefined) {
|
|
149
140
|
where.location_type = options.locationType;
|
|
150
141
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
attributes,
|
|
154
|
-
|
|
155
|
-
|
|
142
|
+
if (options.appendAswId) {
|
|
143
|
+
const aswId = sequelize_1.default.fn("json_build_object", "node", sequelize_1.default.col(`${ropid_gtfs_1.RopidGTFS.stops.pgTableName}.asw_node_id`), "stop", sequelize_1.default.col(`${ropid_gtfs_1.RopidGTFS.stops.pgTableName}.asw_stop_id`));
|
|
144
|
+
attributes.push([aswId, "asw_id"]);
|
|
145
|
+
}
|
|
146
|
+
let include = undefined;
|
|
156
147
|
if (options.includeMetroTrains) {
|
|
157
|
-
//
|
|
158
|
-
//
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
FROM ${ropid_gtfs_1.RopidGTFS.stops.pgTableName} AS stops
|
|
167
|
-
LEFT JOIN ${ropid_gtfs_1.RopidGTFS.stops.pgTableName} AS stops_self ON stops.stop_id LIKE (
|
|
168
|
-
'U' || (REGEXP_MATCH(stops_self.stop_id, '^U(\\d*)Z\\d*.*$'))[1] || 'Z%'
|
|
169
|
-
)
|
|
170
|
-
WHERE
|
|
171
|
-
${shared_1.queryGenerator.getWhereConditions(where, "stops_self")}
|
|
172
|
-
AND (REGEXP_MATCH(stops.stop_id, '^U\\d*Z(\\d*).*$'))[1]::integer >= 100
|
|
173
|
-
`;
|
|
148
|
+
// Workaround for distinct selection
|
|
149
|
+
// https://github.com/sequelize/sequelize/issues/2996
|
|
150
|
+
attributes[0] = [
|
|
151
|
+
sequelize_1.default.literal(`DISTINCT ON(${ropid_gtfs_1.RopidGTFS.stops.pgTableName}.stop_id) ${ropid_gtfs_1.RopidGTFS.stops.pgTableName}.${attributes[0]}`),
|
|
152
|
+
attributes[0],
|
|
153
|
+
];
|
|
154
|
+
const findOptions = this.prepareFindOptionsForMetro(where);
|
|
155
|
+
include = findOptions.include;
|
|
156
|
+
where = findOptions.where;
|
|
174
157
|
}
|
|
175
158
|
let data = [];
|
|
176
159
|
try {
|
|
177
|
-
data = yield
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
160
|
+
data = yield this.sequelizeModel.findAll({
|
|
161
|
+
attributes,
|
|
162
|
+
include,
|
|
163
|
+
where,
|
|
164
|
+
order,
|
|
165
|
+
limit: options.limit,
|
|
166
|
+
offset: options.offset,
|
|
167
|
+
raw: true,
|
|
168
|
+
subQuery: false,
|
|
169
|
+
});
|
|
183
170
|
}
|
|
184
171
|
catch (err) {
|
|
185
172
|
throw new golemio_errors_1.CustomError("Database error", true, "GTFSStopModel", 500, err);
|
|
186
173
|
}
|
|
187
|
-
if (options.appendAswId) {
|
|
188
|
-
data = data.map((row) => {
|
|
189
|
-
row.asw_id = this.parseAswId(row.stop_id);
|
|
190
|
-
return row;
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
174
|
return options.returnRaw ? data : (0, Geo_1.buildGeojsonFeatureCollection)(data, "stop_lon", "stop_lat", true);
|
|
194
175
|
});
|
|
195
176
|
}
|
|
177
|
+
prepareFindOptionsForMetro(innerWhere) {
|
|
178
|
+
// Select metro and train stops within a node
|
|
179
|
+
// matching the previous where criteria
|
|
180
|
+
// matching asw_node_id (stop_id U1040Z16P -> asw_node_id 1040)
|
|
181
|
+
// with asw_stop_id greater than or equal to 100 (stop_id U1040Z101P -> asw_stop_id 101)
|
|
182
|
+
// indicating a metro or train stop
|
|
183
|
+
// EX: U1040Z16P Na Knížecí + U1040Z101P Anděl
|
|
184
|
+
const include = {
|
|
185
|
+
as: "stops_self",
|
|
186
|
+
model: this.sequelizeModel,
|
|
187
|
+
attributes: [],
|
|
188
|
+
on: {
|
|
189
|
+
asw_node_id: {
|
|
190
|
+
[sequelize_1.default.Op.eq]: sequelize_1.default.col(`${ropid_gtfs_1.RopidGTFS.stops.pgTableName}.asw_node_id`),
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
where: innerWhere,
|
|
194
|
+
};
|
|
195
|
+
const where = {
|
|
196
|
+
[sequelize_1.default.Op.or]: [
|
|
197
|
+
innerWhere,
|
|
198
|
+
{
|
|
199
|
+
asw_stop_id: { [sequelize_1.default.Op.gte]: 100 },
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
};
|
|
203
|
+
return { include, where };
|
|
204
|
+
}
|
|
196
205
|
}
|
|
197
206
|
exports.GTFSStopModel = GTFSStopModel;
|
|
198
207
|
//# sourceMappingURL=GTFSStopModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTFSStopModel.js","sourceRoot":"","sources":["../../../../src/output-gateway/ropid-gtfs/models/GTFSStopModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6EAAuE;AACvE,
|
|
1
|
+
{"version":3,"file":"GTFSStopModel.js","sourceRoot":"","sources":["../../../../src/output-gateway/ropid-gtfs/models/GTFSStopModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6EAAuE;AACvE,oFAA2H;AAC3H,yEAAiF;AACjF,+DAK+C;AAC/C,qEAA0E;AAC1E,uEAA4C;AAG5C,MAAa,aAAc,SAAQ,uBAAc;IAI7C;QACI,KAAK,CAAC,sBAAS,CAAC,KAAK,CAAC,IAAI,EAAE,sBAAS,CAAC,KAAK,CAAC,WAAW,EAAE,sBAAS,CAAC,KAAK,CAAC,yBAAyB,EAAE;YAChG,MAAM,EAAE,sBAAS,CAAC,QAAQ;SAC7B,CAAC,CAAC;QANU,qBAAgB,GAAoC,EAAE,CAAC;QAyBjE,cAAS,GAAG,GAAG,EAAE;YACpB,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE;gBAC7C,EAAE,EAAE,YAAY;gBAChB,UAAU,EAAE,aAAa;gBACzB,SAAS,EAAE,aAAa;aAC3B,CAAC,CAAC;QACP,CAAC,CAAC;QAyHF;;WAEG;QACI,WAAM,GAAG,CAAO,EAAU,EAAmC,EAAE;YAClE,OAAO,IAAI,C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