@golemio/pid 2.6.9 → 2.6.10-dev.856817708
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/03_ropidgtfs_dump.sql +1 -1
- package/db/migrations/postgresql/20230502115509-positions-output-view.js +53 -0
- package/db/migrations/postgresql/sqls/20230502115509-positions-output-view-down.sql +7 -0
- package/db/migrations/postgresql/sqls/20230502115509-positions-output-view-up.sql +94 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.js +2 -5
- package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/StopTimeDelayPredictionRepository.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/StopTimeDelayPredictionRepository.js +5 -5
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/StopTimeDelayPredictionRepository.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/VehiclePositionsRouter.d.ts +3 -3
- package/dist/output-gateway/vehicle-positions/VehiclePositionsRouter.js +6 -6
- package/dist/output-gateway/vehicle-positions/VehiclePositionsRouter.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/data-access/ProcessedPositionRepository.d.ts +9 -0
- package/dist/output-gateway/vehicle-positions/data-access/ProcessedPositionRepository.js +21 -0
- package/dist/output-gateway/vehicle-positions/data-access/ProcessedPositionRepository.js.map +1 -0
- package/dist/output-gateway/vehicle-positions/data-access/TripRepository.d.ts +5 -63
- package/dist/output-gateway/vehicle-positions/data-access/TripRepository.js +7 -371
- package/dist/output-gateway/vehicle-positions/data-access/TripRepository.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/data-access/TripWithLastPositionRepository.d.ts +51 -0
- package/dist/output-gateway/vehicle-positions/data-access/TripWithLastPositionRepository.js +240 -0
- package/dist/output-gateway/vehicle-positions/data-access/TripWithLastPositionRepository.js.map +1 -0
- package/dist/output-gateway/vehicle-positions/data-access/helpers/PositionOutputMapper.d.ts +5 -0
- package/dist/output-gateway/vehicle-positions/data-access/helpers/PositionOutputMapper.js +104 -0
- package/dist/output-gateway/vehicle-positions/data-access/helpers/PositionOutputMapper.js.map +1 -0
- package/dist/output-gateway/vehicle-positions/data-access/index.js +5 -1
- package/dist/output-gateway/vehicle-positions/data-access/index.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/data-access/interfaces/{ITripRepository.d.ts → ITripWithPositionRepository.d.ts} +2 -2
- package/dist/output-gateway/vehicle-positions/data-access/interfaces/ITripWithPositionRepository.js +3 -0
- package/dist/output-gateway/vehicle-positions/data-access/interfaces/ITripWithPositionRepository.js.map +1 -0
- package/dist/output-gateway/vehicle-positions/data-access/interfaces/IVPRepositoryInstances.d.ts +4 -2
- package/dist/schema-definitions/vehicle-positions/index.d.ts +0 -8
- package/dist/schema-definitions/vehicle-positions/index.js +0 -8
- package/dist/schema-definitions/vehicle-positions/index.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/index.d.ts +0 -1
- package/dist/schema-definitions/vehicle-positions/models/index.js +0 -1
- package/dist/schema-definitions/vehicle-positions/models/index.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/views/ProcessedPositionModel.d.ts +27 -0
- package/dist/schema-definitions/vehicle-positions/models/views/ProcessedPositionModel.js +37 -0
- package/dist/schema-definitions/vehicle-positions/models/views/ProcessedPositionModel.js.map +1 -0
- package/dist/schema-definitions/vehicle-positions/models/views/StopTimeDelayPredictionModel.js.map +1 -0
- package/dist/schema-definitions/vehicle-positions/models/views/TripWithLastPositionModel.d.ts +52 -0
- package/dist/schema-definitions/vehicle-positions/models/views/TripWithLastPositionModel.js +56 -0
- package/dist/schema-definitions/vehicle-positions/models/views/TripWithLastPositionModel.js.map +1 -0
- package/dist/schema-definitions/vehicle-positions/models/views/index.d.ts +3 -0
- package/dist/schema-definitions/vehicle-positions/models/views/index.js +20 -0
- package/dist/schema-definitions/vehicle-positions/models/views/index.js.map +1 -0
- package/dist/schema-definitions/vehicle-positions/models/views/interfaces/IProcessedPositionDto.d.ts +23 -0
- package/dist/{output-gateway/vehicle-positions/data-access/interfaces/ITripRepository.js → schema-definitions/vehicle-positions/models/views/interfaces/IProcessedPositionDto.js} +1 -1
- package/dist/schema-definitions/vehicle-positions/models/views/interfaces/IProcessedPositionDto.js.map +1 -0
- package/dist/schema-definitions/vehicle-positions/models/views/interfaces/IStopTimeDelayPredictionDto.js.map +1 -0
- package/dist/schema-definitions/vehicle-positions/models/views/interfaces/ITripWithLastPositionDto.d.ts +42 -0
- package/dist/schema-definitions/vehicle-positions/models/views/interfaces/ITripWithLastPositionDto.js +3 -0
- package/dist/schema-definitions/vehicle-positions/models/views/interfaces/ITripWithLastPositionDto.js.map +1 -0
- package/docs/assets/pid_vp_view_erd.png +0 -0
- package/docs/implementation_documentation.md +11 -3
- package/docs/openapi-output.yaml +2 -2
- package/package.json +1 -1
- package/dist/output-gateway/vehicle-positions/data-access/interfaces/ITripRepository.js.map +0 -1
- package/dist/schema-definitions/vehicle-positions/models/StopTimeDelayPredictionModel.js.map +0 -1
- package/dist/schema-definitions/vehicle-positions/models/interfaces/IStopTimeDelayPredictionDto.js.map +0 -1
- /package/dist/schema-definitions/vehicle-positions/models/{StopTimeDelayPredictionModel.d.ts → views/StopTimeDelayPredictionModel.d.ts} +0 -0
- /package/dist/schema-definitions/vehicle-positions/models/{StopTimeDelayPredictionModel.js → views/StopTimeDelayPredictionModel.js} +0 -0
- /package/dist/schema-definitions/vehicle-positions/models/{interfaces → views/interfaces}/IStopTimeDelayPredictionDto.d.ts +0 -0
- /package/dist/schema-definitions/vehicle-positions/models/{interfaces → views/interfaces}/IStopTimeDelayPredictionDto.js +0 -0
|
@@ -558,7 +558,7 @@ VALUES
|
|
|
558
558
|
WITH init_values AS (SELECT NOW()::DATE AS now_date)
|
|
559
559
|
INSERT INTO "vehiclepositions_positions"("created_at","delay","delay_stop_arrival","delay_stop_departure","next_stop_id","shape_dist_traveled","is_canceled","lat","lng","origin_time","origin_timestamp","tracking","trips_id","create_batch_id","created_by","update_batch_id","updated_at","updated_by","id","bearing","cis_last_stop_id","cis_last_stop_sequence","last_stop_id","last_stop_sequence","last_stop_name","next_stop_sequence","speed","last_stop_arrival_time","last_stop_departure_time","next_stop_arrival_time","next_stop_departure_time","asw_last_stop_id","state_process","state_position","this_stop_id","this_stop_sequence")
|
|
560
560
|
VALUES
|
|
561
|
-
(E'2021-03-31 10:53:58.936142+02',-20,-20,NULL,E'U337Z4',1.42,NULL,50.11063,14.50247,E'11:37:10',(SELECT EXTRACT(EPOCH FROM (CONCAT(now_date,'T11:37:10')::TIMESTAMP AT TIME ZONE 'Europe/Prague')) * 1000 FROM init_values),2,E'2019-05-26T09:13:00Z_XX_152_37_201230',NULL,NULL,NULL,(SELECT CONCAT(now_date,'T11:37:10')::TIMESTAMP AT TIME ZONE 'Europe/Prague' FROM init_values),NULL,100015,NULL,NULL,NULL,'U474Z4P',2,'Vysočanská',NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
|
561
|
+
(E'2021-03-31 10:53:58.936142+02',-20,-20,NULL,E'U337Z4',1.42,NULL,50.11063,14.50247,E'11:37:10',(SELECT EXTRACT(EPOCH FROM (CONCAT(now_date,'T11:37:10')::TIMESTAMP AT TIME ZONE 'Europe/Prague')) * 1000 FROM init_values),2,E'2019-05-26T09:13:00Z_XX_152_37_201230',NULL,NULL,NULL,(SELECT CONCAT(now_date,'T11:37:10')::TIMESTAMP AT TIME ZONE 'Europe/Prague' FROM init_values),NULL,100015,NULL,NULL,NULL,'U474Z4P',2,'Vysočanská',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'processed','at_stop','U474Z4P',2);
|
|
562
562
|
|
|
563
563
|
-- TRIP CANCELED
|
|
564
564
|
WITH init_values AS (SELECT NOW()::DATE AS now_date)
|
|
@@ -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', '20230502115509-positions-output-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', '20230502115509-positions-output-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,7 @@
|
|
|
1
|
+
drop view v_vehiclepositions_all_processed_positions;
|
|
2
|
+
drop view v_vehiclepositions_all_trips_with_last_position;
|
|
3
|
+
drop function convert_timestamp_ms_to_iso_string (bigint, varchar);
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
alter view v_vehiclepositions_alerts_last_position rename to v_vehiclepositions_last_position;
|
|
7
|
+
comment on view v_vehiclepositions_last_position is null;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
create function convert_timestamp_ms_to_iso_string(timestamp_ms bigint, timezone varchar DEFAULT 'Europe/Prague') RETURNS varchar AS $$
|
|
2
|
+
select TO_CHAR(DATE_TRUNC('second', TO_TIMESTAMP(timestamp_ms / 1000)) at TIME zone timezone, 'YYYY-MM-DD"T"HH24:MI:SS') || replace('+' || to_char(DATE_TRUNC('second', TO_TIMESTAMP(timestamp_ms / 1000)) at TIME zone timezone - DATE_TRUNC('second', TO_TIMESTAMP(timestamp_ms / 1000)) at TIME zone 'UTC', 'HH24:MMFM'), '+-', '-')
|
|
3
|
+
$$ LANGUAGE SQL IMMUTABLE;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
create view v_vehiclepositions_all_trips_with_last_position as
|
|
7
|
+
select
|
|
8
|
+
vt.id,
|
|
9
|
+
vt.agency_name_real,
|
|
10
|
+
vt.agency_name_scheduled,
|
|
11
|
+
vt.cis_line_id,
|
|
12
|
+
vt.cis_trip_number,
|
|
13
|
+
vt.gtfs_route_id,
|
|
14
|
+
vt.gtfs_route_short_name,
|
|
15
|
+
vt.gtfs_route_type,
|
|
16
|
+
vt.gtfs_trip_headsign,
|
|
17
|
+
vt.gtfs_trip_short_name,
|
|
18
|
+
vt.gtfs_trip_id,
|
|
19
|
+
vt.origin_route_name,
|
|
20
|
+
vt.run_number,
|
|
21
|
+
vt.vehicle_registration_number,
|
|
22
|
+
vt.vehicle_type_id,
|
|
23
|
+
vt.wheelchair_accessible,
|
|
24
|
+
vt.updated_at,
|
|
25
|
+
convert_timestamp_ms_to_iso_string(vt.start_timestamp) as start_timestamp_isostring,
|
|
26
|
+
vp.bearing,
|
|
27
|
+
vp.delay,
|
|
28
|
+
vp.delay_stop_arrival,
|
|
29
|
+
vp.delay_stop_departure,
|
|
30
|
+
vp.is_canceled,
|
|
31
|
+
vp.last_stop_id,
|
|
32
|
+
vp.last_stop_sequence,
|
|
33
|
+
vp.last_stop_headsign,
|
|
34
|
+
vp.lat,
|
|
35
|
+
vp.lng,
|
|
36
|
+
vp.next_stop_id,
|
|
37
|
+
vp.next_stop_sequence,
|
|
38
|
+
vp.shape_dist_traveled,
|
|
39
|
+
vp.speed,
|
|
40
|
+
vp.state_position,
|
|
41
|
+
vp.tracking,
|
|
42
|
+
convert_timestamp_ms_to_iso_string(vp.last_stop_arrival_time) as last_stop_arrival_time_isostring,
|
|
43
|
+
convert_timestamp_ms_to_iso_string(vp.last_stop_departure_time) as last_stop_departure_time_isostring,
|
|
44
|
+
convert_timestamp_ms_to_iso_string(vp.next_stop_arrival_time) as next_stop_arrival_time_isostring,
|
|
45
|
+
convert_timestamp_ms_to_iso_string(vp.next_stop_departure_time) as next_stop_departure_time_isostring,
|
|
46
|
+
convert_timestamp_ms_to_iso_string(vp.origin_timestamp) as origin_timestamp_isostring
|
|
47
|
+
from
|
|
48
|
+
vehiclepositions_trips vt
|
|
49
|
+
inner join vehiclepositions_positions vp on
|
|
50
|
+
vt.last_position_id = vp.id
|
|
51
|
+
and (vp.valid_to is null
|
|
52
|
+
or vp.valid_to >= extract(epoch from now()) * 1000)
|
|
53
|
+
and vp.state_process = 'processed';
|
|
54
|
+
|
|
55
|
+
comment on view v_vehiclepositions_all_trips_with_last_position is '
|
|
56
|
+
View of all trips with last processed position. Used for serving data to the vehiclepositions output API.
|
|
57
|
+
';
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
create view v_vehiclepositions_all_processed_positions as
|
|
61
|
+
select
|
|
62
|
+
trips_id,
|
|
63
|
+
bearing,
|
|
64
|
+
"delay",
|
|
65
|
+
delay_stop_arrival,
|
|
66
|
+
delay_stop_departure,
|
|
67
|
+
vp.is_canceled,
|
|
68
|
+
convert_timestamp_ms_to_iso_string(last_stop_arrival_time) as last_stop_arrival_time_isostring,
|
|
69
|
+
convert_timestamp_ms_to_iso_string(last_stop_departure_time) as last_stop_departure_time_isostring,
|
|
70
|
+
last_stop_id,
|
|
71
|
+
last_stop_sequence,
|
|
72
|
+
lat,
|
|
73
|
+
lng,
|
|
74
|
+
convert_timestamp_ms_to_iso_string(next_stop_arrival_time) as next_stop_arrival_time_isostring,
|
|
75
|
+
convert_timestamp_ms_to_iso_string(next_stop_departure_time) as next_stop_departure_time_isostring,
|
|
76
|
+
next_stop_id,
|
|
77
|
+
next_stop_sequence,
|
|
78
|
+
convert_timestamp_ms_to_iso_string(origin_timestamp) as origin_timestamp_isostring,
|
|
79
|
+
shape_dist_traveled,
|
|
80
|
+
speed,
|
|
81
|
+
state_position
|
|
82
|
+
from
|
|
83
|
+
vehiclepositions_positions vp
|
|
84
|
+
where state_process = 'processed';
|
|
85
|
+
|
|
86
|
+
comment on view v_vehiclepositions_all_processed_positions is '
|
|
87
|
+
View of all processed positions. Used for enriching trips from v_vehiclepositions_all_trips_with_last_position with all positions.
|
|
88
|
+
';
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
alter view v_vehiclepositions_last_position rename to v_vehiclepositions_alerts_last_position;
|
|
92
|
+
comment on view v_vehiclepositions_alerts_last_position is '
|
|
93
|
+
Used only for alerting purposes.
|
|
94
|
+
';
|
package/dist/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.js
CHANGED
|
@@ -48,7 +48,6 @@ const precomputed_1 = require("../../../../ropid-gtfs/data-access/precomputed");
|
|
|
48
48
|
const const_1 = require("../../../../../schema-definitions/const");
|
|
49
49
|
const models_1 = require("../../../../../schema-definitions/vehicle-positions/models");
|
|
50
50
|
const connectors_1 = require("@golemio/core/dist/integration-engine/connectors");
|
|
51
|
-
const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
|
|
52
51
|
const models_2 = require("@golemio/core/dist/integration-engine/models");
|
|
53
52
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
54
53
|
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
@@ -107,9 +106,8 @@ class CommonRunsRepository extends models_2.PostgresModel {
|
|
|
107
106
|
};
|
|
108
107
|
}
|
|
109
108
|
catch (err) {
|
|
110
|
-
helpers_1.log.error(`${this.name}: createAndAssociate failed`, err);
|
|
111
109
|
yield t.rollback();
|
|
112
|
-
throw new golemio_errors_1.CustomError("
|
|
110
|
+
throw new golemio_errors_1.CustomError("createAndAssociate: error while saving to database", true, this.name, 4001, err);
|
|
113
111
|
}
|
|
114
112
|
});
|
|
115
113
|
this.updateAndAssociate = ({ run, run_message }, runId) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -127,9 +125,8 @@ class CommonRunsRepository extends models_2.PostgresModel {
|
|
|
127
125
|
};
|
|
128
126
|
}
|
|
129
127
|
catch (err) {
|
|
130
|
-
helpers_1.log.error(`${this.name}: updateAndAssociate failed`, err);
|
|
131
128
|
yield t.rollback();
|
|
132
|
-
throw new golemio_errors_1.CustomError("
|
|
129
|
+
throw new golemio_errors_1.CustomError("updateAndAssociate: error while saving to database", true, this.name, 4001, err);
|
|
133
130
|
}
|
|
134
131
|
});
|
|
135
132
|
this.deleteNHoursOldData = (hours) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonRunsRepository.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/data-access/CommonRunsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gFAAgF;AAEhF,mEAAuC;AACvC,uFAAgE;AAEhE,iFAAqF;
|
|
1
|
+
{"version":3,"file":"CommonRunsRepository.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/data-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CAAC,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,EAAE;YACvE,SAAS,EAAE,IAAI;YACf,UAAU,EAAE,SAAS;YACrB,EAAE,EAAE,cAAc;SACrB,CAAC,CAAC;QAEH,IAAI,CAAC,sBAAsB,GAAG,IAAI,oCAAsB,EAAE,CAAC;IAC/D,CAAC;CA+GJ;AApKD,oDAoKC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StopTimeDelayPredictionModel } from "../../../../../schema-definitions/vehicle-positions/models";
|
|
1
|
+
import { StopTimeDelayPredictionModel } from "../../../../../schema-definitions/vehicle-positions/models/views";
|
|
2
2
|
import { IModel, PostgresModel } from "@golemio/core/dist/integration-engine/models";
|
|
3
3
|
import { ModelStatic } from "@golemio/core/dist/shared/sequelize";
|
|
4
4
|
export declare class StopTimeDelayPredictionRepository extends PostgresModel implements IModel {
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StopTimeDelayPredictionRepository = void 0;
|
|
4
4
|
const const_1 = require("../../../../../schema-definitions/const");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const views_1 = require("../../../../../schema-definitions/vehicle-positions/models/views");
|
|
6
|
+
const models_1 = require("@golemio/core/dist/integration-engine/models");
|
|
7
7
|
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
8
|
-
class StopTimeDelayPredictionRepository extends
|
|
8
|
+
class StopTimeDelayPredictionRepository extends models_1.PostgresModel {
|
|
9
9
|
constructor() {
|
|
10
10
|
super("StopTimeDelayPredictionRepository", {
|
|
11
|
-
pgTableName:
|
|
11
|
+
pgTableName: views_1.StopTimeDelayPredictionModel.tableName,
|
|
12
12
|
pgSchema: const_1.PG_SCHEMA,
|
|
13
|
-
outputSequelizeAttributes:
|
|
13
|
+
outputSequelizeAttributes: views_1.StopTimeDelayPredictionModel.attributeModel,
|
|
14
14
|
savingType: "insertOnly",
|
|
15
15
|
}, new golemio_validator_1.JSONSchemaValidator("StopTimeDelayPredictionReadOnly", {}));
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StopTimeDelayPredictionRepository.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/StopTimeDelayPredictionRepository.ts"],"names":[],"mappings":";;;AAAA,mEAAuC;AACvC,
|
|
1
|
+
{"version":3,"file":"StopTimeDelayPredictionRepository.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/StopTimeDelayPredictionRepository.ts"],"names":[],"mappings":";;;AAAA,mEAAuC;AACvC,4FAAmF;AACnF,yEAAqF;AACrF,mFAAkF;AAGlF,MAAa,iCAAkC,SAAQ,sBAAa;IAGhE;QACI,KAAK,CACD,mCAAmC,EACnC;YACI,WAAW,EAAE,oCAA4B,CAAC,SAAS;YACnD,QAAQ,EAAE,iBAAS;YACnB,yBAAyB,EAAE,oCAA4B,CAAC,cAAc;YACtE,UAAU,EAAE,YAAY;SAC3B,EACD,IAAI,uCAAmB,CAAC,iCAAiC,EAAE,EAAE,CAAC,CACjE,CAAC;IACN,CAAC;CACJ;AAfD,8EAeC"}
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
/// <reference types="express" />
|
|
7
7
|
import { NextFunction, Request, Response, Router } from "@golemio/core/dist/shared/express";
|
|
8
|
-
import {
|
|
8
|
+
import { ITripWithPositionRepository } from "./data-access/interfaces/ITripWithPositionRepository";
|
|
9
9
|
export declare class VehiclePositionsRouter {
|
|
10
|
-
router:
|
|
11
|
-
protected
|
|
10
|
+
router: Router;
|
|
11
|
+
protected tripWithPositionRepository: ITripWithPositionRepository;
|
|
12
12
|
constructor();
|
|
13
13
|
GetAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
14
14
|
GetOne: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
@@ -21,10 +21,10 @@ exports.vehiclepositionsRouter = exports.VehiclePositionsRouter = void 0;
|
|
|
21
21
|
const shared_1 = require("../shared");
|
|
22
22
|
const constants_1 = require("../shared/constants");
|
|
23
23
|
const trace_provider_1 = require("@golemio/core/dist/monitoring/opentelemetry/trace-provider");
|
|
24
|
-
const config_1 = require("@golemio/core/dist/output-gateway/config");
|
|
25
|
-
const redis_1 = require("@golemio/core/dist/output-gateway/redis");
|
|
26
24
|
const Utils_1 = require("@golemio/core/dist/output-gateway/Utils");
|
|
27
25
|
const Validation_1 = require("@golemio/core/dist/output-gateway/Validation");
|
|
26
|
+
const config_1 = require("@golemio/core/dist/output-gateway/config");
|
|
27
|
+
const redis_1 = require("@golemio/core/dist/output-gateway/redis");
|
|
28
28
|
const express_1 = require("@golemio/core/dist/shared/express");
|
|
29
29
|
const express_validator_1 = require("@golemio/core/dist/shared/express-validator");
|
|
30
30
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
@@ -33,12 +33,11 @@ const util_1 = require("util");
|
|
|
33
33
|
const data_access_1 = require("./data-access");
|
|
34
34
|
class VehiclePositionsRouter {
|
|
35
35
|
constructor() {
|
|
36
|
-
this.router = (0, express_1.Router)();
|
|
37
36
|
this.GetAll = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
38
37
|
const preferredTimezone = shared_1.RopidRouterUtils.getPreferredTimezone(req.query.preferredTimezone);
|
|
39
38
|
const span = (0, trace_provider_1.createChildSpan)("VehiclePositionsRouter.GetAll", config_1.config.telemetry);
|
|
40
39
|
try {
|
|
41
|
-
const result = yield this.
|
|
40
|
+
const result = yield this.tripWithPositionRepository.GetAll({
|
|
42
41
|
cisTripNumber: Number(req.query.cisTripNumber) || undefined,
|
|
43
42
|
includeNotTracking: (0, Utils_1.parseBooleanQueryParam)(req.query.includeNotTracking),
|
|
44
43
|
includePositions: (0, Utils_1.parseBooleanQueryParam)(req.query.includePositions),
|
|
@@ -63,7 +62,7 @@ class VehiclePositionsRouter {
|
|
|
63
62
|
const id = req.params.id;
|
|
64
63
|
const preferredTimezone = shared_1.RopidRouterUtils.getPreferredTimezone(req.query.preferredTimezone);
|
|
65
64
|
try {
|
|
66
|
-
const data = yield this.
|
|
65
|
+
const data = yield this.tripWithPositionRepository.GetOneByGTFSTripId(id, {
|
|
67
66
|
includeNotTracking: (0, Utils_1.parseBooleanQueryParam)(req.query.includeNotTracking),
|
|
68
67
|
includePositions: (0, Utils_1.parseBooleanQueryParam)(req.query.includePositions),
|
|
69
68
|
preferredTimezone,
|
|
@@ -202,7 +201,8 @@ class VehiclePositionsRouter {
|
|
|
202
201
|
this.router.get("/gtfsrt/alerts.json", this.GetGtfsRtAlertsJSON);
|
|
203
202
|
this.router.get("/gtfsrt/alerts.pb", this.GetGtfsRtAlerts);
|
|
204
203
|
};
|
|
205
|
-
this.
|
|
204
|
+
this.router = (0, express_1.Router)();
|
|
205
|
+
this.tripWithPositionRepository = data_access_1.repositories.tripWithLastPositionRepository;
|
|
206
206
|
this.initRoutes("5 seconds");
|
|
207
207
|
}
|
|
208
208
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VehiclePositionsRouter.js","sourceRoot":"","sources":["../../../src/output-gateway/vehicle-positions/VehiclePositionsRouter.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;AAEH,sCAA8C;AAC9C,mDAAwD;AACxD,+FAA6F;AAC7F,qEAAkE;AAClE,mEAA6F;AAC7F
|
|
1
|
+
{"version":3,"file":"VehiclePositionsRouter.js","sourceRoot":"","sources":["../../../src/output-gateway/vehicle-positions/VehiclePositionsRouter.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;AAEH,sCAA8C;AAC9C,mDAAwD;AACxD,+FAA6F;AAC7F,mEAAiF;AACjF,6EAAkH;AAClH,qEAAkE;AAClE,mEAA6F;AAC7F,+DAA4F;AAC5F,mFAA2E;AAC3E,6EAAuE;AACvE,gGAA+D;AAC/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AC;QA3LE,IAAI,CAAC,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;QACvB,IAAI,CAAC,0BAA0B,GAAG,0BAAY,CAAC,8BAA8B,CAAC;QAC9E,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;CAyLJ;AAjMD,wDAiMC;AAED,MAAM,sBAAsB,GAAW,IAAI,sBAAsB,EAAE,CAAC,MAAM,CAAC;AAElE,wDAAsB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ProcessedPositionModel } from "../../../schema-definitions/vehicle-positions/models/views";
|
|
2
|
+
import { SequelizeModel } from "@golemio/core/dist/output-gateway";
|
|
3
|
+
import { ModelStatic } from "@golemio/core/dist/shared/sequelize";
|
|
4
|
+
export declare class ProcessedPositionRepository extends SequelizeModel {
|
|
5
|
+
sequelizeModel: ModelStatic<ProcessedPositionModel>;
|
|
6
|
+
constructor();
|
|
7
|
+
GetAll(): never;
|
|
8
|
+
GetOne(): never;
|
|
9
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProcessedPositionRepository = void 0;
|
|
4
|
+
const const_1 = require("../../../schema-definitions/const");
|
|
5
|
+
const views_1 = require("../../../schema-definitions/vehicle-positions/models/views");
|
|
6
|
+
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
7
|
+
class ProcessedPositionRepository extends output_gateway_1.SequelizeModel {
|
|
8
|
+
constructor() {
|
|
9
|
+
super("ProcessedPositionRepository", views_1.ProcessedPositionModel.tableName, views_1.ProcessedPositionModel.attributeModel, {
|
|
10
|
+
schema: const_1.PG_SCHEMA,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
GetAll() {
|
|
14
|
+
throw new Error("Not implemented");
|
|
15
|
+
}
|
|
16
|
+
GetOne() {
|
|
17
|
+
throw new Error("Not implemented");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.ProcessedPositionRepository = ProcessedPositionRepository;
|
|
21
|
+
//# sourceMappingURL=ProcessedPositionRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProcessedPositionRepository.js","sourceRoot":"","sources":["../../../../src/output-gateway/vehicle-positions/data-access/ProcessedPositionRepository.ts"],"names":[],"mappings":";;;AAAA,6DAAuC;AACvC,sFAA6E;AAC7E,sEAAmE;AAGnE,MAAa,2BAA4B,SAAQ,+BAAc;IAG3D;QACI,KAAK,CAAC,6BAA6B,EAAE,8BAAsB,CAAC,SAAS,EAAE,8BAAsB,CAAC,cAAc,EAAE;YAC1G,MAAM,EAAE,iBAAS;SACpB,CAAC,CAAC;IACP,CAAC;IAEM,MAAM;QACT,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAEM,MAAM;QACT,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ;AAhBD,kEAgBC"}
|
|
@@ -1,67 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VPTripsModel } from "../../../schema-definitions/vehicle-positions/models";
|
|
2
2
|
import { SequelizeModel } from "@golemio/core/dist/output-gateway/models";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { ModelStatic } from "@golemio/core/dist/shared/sequelize";
|
|
4
|
+
export declare class TripRepository extends SequelizeModel {
|
|
5
|
+
sequelizeModel: ModelStatic<VPTripsModel>;
|
|
6
6
|
constructor();
|
|
7
|
-
|
|
8
|
-
/** Retrieves all vehicle trips
|
|
9
|
-
* @param {object} options Options object with params
|
|
10
|
-
* @param {number} [options.limit] Limit
|
|
11
|
-
* @param {number} [options.offset] Offset
|
|
12
|
-
* @param {string} [options.routeId] Filter trips by specific route id
|
|
13
|
-
* @param {string} [options.routeShortName] Filter trips by specific route short name
|
|
14
|
-
* @param {string} [options.tripId] Filter trips by specific trip id
|
|
15
|
-
* @param {boolean} [options.includeNotTracking] Should include not tracking vehicle positions (those off a trip)
|
|
16
|
-
* @param {boolean} [options.includePositions] Should include all vehicle positions
|
|
17
|
-
* @returns Array of the retrieved records
|
|
18
|
-
*/
|
|
19
|
-
GetAll: (options: {
|
|
20
|
-
cisTripNumber?: number;
|
|
21
|
-
routeId?: string;
|
|
22
|
-
routeShortName?: string;
|
|
23
|
-
tripId?: string;
|
|
24
|
-
includeNotTracking?: boolean;
|
|
25
|
-
includePositions?: boolean;
|
|
26
|
-
includeNotPublic?: boolean;
|
|
27
|
-
limit?: number;
|
|
28
|
-
offset?: number;
|
|
29
|
-
updatedSince?: Date | null;
|
|
30
|
-
preferredTimezone: string;
|
|
31
|
-
}) => Promise<ITripGetAllOutput>;
|
|
7
|
+
GetAll(): never;
|
|
32
8
|
GetOne(): never;
|
|
33
|
-
/** Retrieves specific vehicle trip
|
|
34
|
-
* @param {string} id Id of the trip
|
|
35
|
-
* @param {object} [options] Options object with params
|
|
36
|
-
* @param {string} [options.includeNotTracking] Returns last known trip even if it is not tracked at time
|
|
37
|
-
* @param {boolean} [options.includePositions] Should include all vehicle positions
|
|
38
|
-
* @returns Object of the retrieved record or null
|
|
39
|
-
*/
|
|
40
|
-
GetOneByGTFSTripId: (id: string, options: {
|
|
41
|
-
includeNotTracking?: boolean;
|
|
42
|
-
includePositions?: boolean;
|
|
43
|
-
includeNotPublic?: boolean;
|
|
44
|
-
preferredTimezone: string;
|
|
45
|
-
}) => Promise<IGeoJSONFeature | null>;
|
|
46
|
-
/**
|
|
47
|
-
* Convert db result to proper output format
|
|
48
|
-
* @param {object} item Trip object
|
|
49
|
-
* @return
|
|
50
|
-
*/
|
|
51
|
-
private ConvertItem;
|
|
52
|
-
/** Prepare orm query with selected params
|
|
53
|
-
* @param {object} options Options object with params
|
|
54
|
-
* @param {boolean} [options.includeNotTracking] Should include all vehicles, even not tracked
|
|
55
|
-
* @param {boolean} [options.includePositions] Should include all vehicle positions
|
|
56
|
-
* @param {Date | null} [options.updatedSince] Should include all newer positions than updatedSince
|
|
57
|
-
* @param {string} [options.preferredTimezone] Preferred timezone code
|
|
58
|
-
* @returns Array of inclusions
|
|
59
|
-
*/
|
|
60
|
-
private ComposeIncludes;
|
|
61
|
-
/** Creates Projection Alias for epoch in milliseconds column converted to ISO String in defined timezone
|
|
62
|
-
* @param {string} name Column name
|
|
63
|
-
* @param {string} preferredTimezone Preferred timezone code
|
|
64
|
-
* @returns Projection Alias with _isostring suffix
|
|
65
|
-
*/
|
|
66
|
-
private convertEpochMsColumnToISOString;
|
|
67
9
|
}
|