@golemio/pid 2.2.10-dev.590640408 → 2.2.10-dev.592415990
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/ropid-vymi/models/RopidVYMIEventsModel.js +9 -20
- package/dist/integration-engine/ropid-vymi/models/RopidVYMIEventsModel.js.map +1 -1
- package/dist/output-gateway/pid/PIDRouter.d.ts +7 -17
- package/dist/output-gateway/pid/PIDRouter.js +33 -146
- package/dist/output-gateway/pid/PIDRouter.js.map +1 -1
- package/dist/output-gateway/pid/constants/index.d.ts +1 -0
- package/dist/output-gateway/pid/constants/index.js +18 -0
- package/dist/output-gateway/pid/constants/index.js.map +1 -0
- package/dist/output-gateway/pid/constants/validations.d.ts +7 -0
- package/dist/output-gateway/pid/constants/validations.js +29 -0
- package/dist/output-gateway/pid/constants/validations.js.map +1 -0
- package/dist/output-gateway/pid/controllers/DepartureBoardsController.d.ts +7 -0
- package/dist/output-gateway/pid/controllers/DepartureBoardsController.js +79 -0
- package/dist/output-gateway/pid/controllers/DepartureBoardsController.js.map +1 -0
- package/dist/output-gateway/pid/controllers/InfotextsController.d.ts +7 -0
- package/dist/output-gateway/pid/controllers/InfotextsController.js +36 -0
- package/dist/output-gateway/pid/controllers/InfotextsController.js.map +1 -0
- package/dist/output-gateway/pid/controllers/index.d.ts +2 -0
- package/dist/output-gateway/pid/controllers/index.js +19 -0
- package/dist/output-gateway/pid/controllers/index.js.map +1 -0
- package/dist/output-gateway/pid/dto/DepartureBoardsDTO.d.ts +17 -0
- package/dist/output-gateway/pid/dto/DepartureBoardsDTO.js +67 -0
- package/dist/output-gateway/pid/dto/DepartureBoardsDTO.js.map +1 -0
- package/dist/output-gateway/pid/dto/index.d.ts +1 -0
- package/dist/output-gateway/pid/dto/index.js +18 -0
- package/dist/output-gateway/pid/dto/index.js.map +1 -0
- package/dist/output-gateway/pid/middleware/checkTimeFromMiddleware.d.ts +6 -0
- package/dist/output-gateway/pid/middleware/checkTimeFromMiddleware.js +28 -0
- package/dist/output-gateway/pid/middleware/checkTimeFromMiddleware.js.map +1 -0
- package/dist/output-gateway/pid/middleware/index.d.ts +1 -0
- package/dist/output-gateway/pid/middleware/index.js +18 -0
- package/dist/output-gateway/pid/middleware/index.js.map +1 -0
- package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.d.ts +1 -2
- package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.js +0 -6
- package/dist/output-gateway/pid/models/PIDDepartureBoardsModel.js.map +1 -1
- package/dist/output-gateway/pid/models/RopidDeparturesDirectionsModel.d.ts +1 -17
- package/dist/output-gateway/pid/models/RopidDeparturesDirectionsModel.js +1 -17
- package/dist/output-gateway/pid/models/RopidDeparturesDirectionsModel.js.map +1 -1
- package/dist/output-gateway/pid/models/RopidVYMIEventsRoutesModel.d.ts +9 -0
- package/dist/output-gateway/pid/models/RopidVYMIEventsRoutesModel.js +21 -0
- package/dist/output-gateway/pid/models/RopidVYMIEventsRoutesModel.js.map +1 -0
- package/dist/output-gateway/pid/models/RopidVYMIEventsStopsModel.d.ts +28 -18
- package/dist/output-gateway/pid/models/RopidVYMIEventsStopsModel.js +85 -26
- package/dist/output-gateway/pid/models/RopidVYMIEventsStopsModel.js.map +1 -1
- package/dist/output-gateway/pid/models/index.d.ts +1 -0
- package/dist/output-gateway/pid/models/index.js +1 -0
- package/dist/output-gateway/pid/models/index.js.map +1 -1
- package/dist/output-gateway/ropid-gtfs/models/GTFSStopModel.d.ts +1 -1
- package/dist/output-gateway/shared/RopidRouterUtils.d.ts +5 -0
- package/dist/output-gateway/shared/RopidRouterUtils.js +7 -0
- package/dist/output-gateway/shared/RopidRouterUtils.js.map +1 -1
- package/dist/output-gateway/shared/decorators/index.d.ts +1 -0
- package/dist/output-gateway/shared/decorators/index.js +18 -0
- package/dist/output-gateway/shared/decorators/index.js.map +1 -0
- package/dist/output-gateway/shared/decorators/transformers.d.ts +2 -0
- package/dist/output-gateway/shared/decorators/transformers.js +9 -0
- package/dist/output-gateway/shared/decorators/transformers.js.map +1 -0
- package/dist/output-gateway/vehicle-positions/VehiclePositionsRouter.js +0 -1
- package/dist/output-gateway/vehicle-positions/VehiclePositionsRouter.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,67 @@
|
|
|
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.DepartureBoardsQueryDTO = void 0;
|
|
13
|
+
const decorators_1 = require("../../shared/decorators");
|
|
14
|
+
class DepartureBoardsQueryDTO {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.aswIds = [];
|
|
17
|
+
this.cisIds = [];
|
|
18
|
+
this.ids = [];
|
|
19
|
+
this.names = [];
|
|
20
|
+
this.skip = [];
|
|
21
|
+
this.limit = 20;
|
|
22
|
+
this.minutesAfter = 180;
|
|
23
|
+
this.minutesBefore = 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, decorators_1.TransformArray)(),
|
|
28
|
+
__metadata("design:type", Array)
|
|
29
|
+
], DepartureBoardsQueryDTO.prototype, "aswIds", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, decorators_1.TransformArray)(),
|
|
32
|
+
__metadata("design:type", Array)
|
|
33
|
+
], DepartureBoardsQueryDTO.prototype, "cisIds", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, decorators_1.TransformArray)(),
|
|
36
|
+
__metadata("design:type", Array)
|
|
37
|
+
], DepartureBoardsQueryDTO.prototype, "ids", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, decorators_1.TransformArray)(),
|
|
40
|
+
__metadata("design:type", Array)
|
|
41
|
+
], DepartureBoardsQueryDTO.prototype, "names", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, decorators_1.TransformArray)(),
|
|
44
|
+
__metadata("design:type", Array)
|
|
45
|
+
], DepartureBoardsQueryDTO.prototype, "skip", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, decorators_1.TransformInteger)(),
|
|
48
|
+
__metadata("design:type", Number)
|
|
49
|
+
], DepartureBoardsQueryDTO.prototype, "limit", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, decorators_1.TransformInteger)(),
|
|
52
|
+
__metadata("design:type", Number)
|
|
53
|
+
], DepartureBoardsQueryDTO.prototype, "minutesAfter", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, decorators_1.TransformInteger)(),
|
|
56
|
+
__metadata("design:type", Number)
|
|
57
|
+
], DepartureBoardsQueryDTO.prototype, "minutesBefore", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, decorators_1.TransformInteger)(),
|
|
60
|
+
__metadata("design:type", Number)
|
|
61
|
+
], DepartureBoardsQueryDTO.prototype, "total", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, decorators_1.TransformInteger)(),
|
|
64
|
+
__metadata("design:type", Number)
|
|
65
|
+
], DepartureBoardsQueryDTO.prototype, "offset", void 0);
|
|
66
|
+
exports.DepartureBoardsQueryDTO = DepartureBoardsQueryDTO;
|
|
67
|
+
//# sourceMappingURL=DepartureBoardsDTO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DepartureBoardsDTO.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/dto/DepartureBoardsDTO.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wDAAyE;AAEzE,MAAa,uBAAuB;IAApC;QAEI,WAAM,GAAa,EAAE,CAAC;QAGtB,WAAM,GAAa,EAAE,CAAC;QAGtB,QAAG,GAAa,EAAE,CAAC;QAGnB,UAAK,GAAa,EAAE,CAAC;QAGrB,SAAI,GAAa,EAAE,CAAC;QAGpB,UAAK,GAAW,EAAE,CAAC;QAGnB,iBAAY,GAAW,GAAG,CAAC;QAG3B,kBAAa,GAAW,CAAC,CAAC;IAiB9B,CAAC;CAAA;AAtCG;IADC,IAAA,2BAAc,GAAE;;uDACK;AAGtB;IADC,IAAA,2BAAc,GAAE;;uDACK;AAGtB;IADC,IAAA,2BAAc,GAAE;;oDACE;AAGnB;IADC,IAAA,2BAAc,GAAE;;sDACI;AAGrB;IADC,IAAA,2BAAc,GAAE;;qDACG;AAGpB;IADC,IAAA,6BAAgB,GAAE;;sDACA;AAGnB;IADC,IAAA,6BAAgB,GAAE;;6DACQ;AAG3B;IADC,IAAA,6BAAgB,GAAE;;8DACO;AAG1B;IADC,IAAA,6BAAgB,GAAE;;sDACJ;AAaf;IADC,IAAA,6BAAgB,GAAE;;uDACH;AAvCpB,0DAwCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./DepartureBoardsDTO";
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./DepartureBoardsDTO"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/dto/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.checkTimeFromMiddleware = exports.defaultTimeQueryParams = void 0;
|
|
7
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
8
|
+
const moment_timezone_1 = __importDefault(require("@golemio/core/dist/shared/moment-timezone"));
|
|
9
|
+
const class_transformer_1 = require("class-transformer");
|
|
10
|
+
const dto_1 = require("../dto");
|
|
11
|
+
exports.defaultTimeQueryParams = {
|
|
12
|
+
hoursBefore: 6,
|
|
13
|
+
hoursAfter: 7 * 24,
|
|
14
|
+
};
|
|
15
|
+
const checkTimeFromMiddleware = (routerName) => {
|
|
16
|
+
return (req, _res, next) => {
|
|
17
|
+
const query = (0, class_transformer_1.plainToInstance)(dto_1.DepartureBoardsQueryDTO, req.query, { excludeExtraneousValues: true });
|
|
18
|
+
const timeFrom = query.timeFrom ? (0, moment_timezone_1.default)(query.timeFrom) : null;
|
|
19
|
+
const currentMoment = (0, moment_timezone_1.default)();
|
|
20
|
+
if (timeFrom &&
|
|
21
|
+
!timeFrom.isBetween(currentMoment.clone().subtract(exports.defaultTimeQueryParams.hoursBefore, "hours"), currentMoment.clone().add(exports.defaultTimeQueryParams.hoursAfter, "hours"), undefined, "[]")) {
|
|
22
|
+
return next(new golemio_errors_1.CustomError("Parameter timeFrom must be in interval [-6h; +7d]", true, routerName || "BaseRouter", 400));
|
|
23
|
+
}
|
|
24
|
+
return next();
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
exports.checkTimeFromMiddleware = checkTimeFromMiddleware;
|
|
28
|
+
//# sourceMappingURL=checkTimeFromMiddleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkTimeFromMiddleware.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/middleware/checkTimeFromMiddleware.ts"],"names":[],"mappings":";;;;;;AACA,6EAAuE;AACvE,gGAA+D;AAC/D,yDAAoD;AACpD,gCAAsD;AAEzC,QAAA,sBAAsB,GAAG;IAClC,WAAW,EAAE,CAAC;IACd,UAAU,EAAE,CAAC,GAAG,EAAE;CACrB,CAAC;AAEK,MAAM,uBAAuB,GAAG,CAAC,UAAmB,EAAkB,EAAE;IAC3E,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QACvB,MAAM,KAAK,GAAG,IAAA,mCAAe,EAAC,6BAAuB,EAAE,GAAG,CAAC,KAAK,EAAE,EAAE,uBAAuB,EAAE,IAAI,EAAE,CAAC,CAAC;QACrG,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAA,yBAAM,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAChE,MAAM,aAAa,GAAG,IAAA,yBAAM,GAAE,CAAC;QAE/B,IACI,QAAQ;YACR,CAAC,QAAQ,CAAC,SAAS,CACf,aAAa,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,8BAAsB,CAAC,WAAW,EAAE,OAAO,CAAC,EAC3E,aAAa,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,8BAAsB,CAAC,UAAU,EAAE,OAAO,CAAC,EACrE,SAAS,EACT,IAAI,CACP,EACH;YACE,OAAO,IAAI,CACP,IAAI,4BAAW,CAAC,mDAAmD,EAAE,IAAI,EAAE,UAAU,IAAI,YAAY,EAAE,GAAG,CAAC,CAC9G,CAAC;SACL;QACD,OAAO,IAAI,EAAE,CAAC;IAClB,CAAC,CAAC;AACN,CAAC,CAAC;AArBW,QAAA,uBAAuB,2BAqBlC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./checkTimeFromMiddleware";
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./checkTimeFromMiddleware"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/middleware/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Moment } from "@golemio/core/dist/shared/moment-timezone";
|
|
2
2
|
declare class PIDDepartureBoardsModel {
|
|
3
3
|
private stopsMaxCount;
|
|
4
|
-
private ropidVYMIEventsModel;
|
|
5
4
|
private ropidVYMIEventsStopsModel;
|
|
6
5
|
private ropidDeparturesDirectionsModel;
|
|
7
6
|
private ropidDeparturesModel;
|
|
@@ -12,7 +11,7 @@ declare class PIDDepartureBoardsModel {
|
|
|
12
11
|
*/
|
|
13
12
|
GetAll: (options: {
|
|
14
13
|
aswIds?: string[];
|
|
15
|
-
cisIds?:
|
|
14
|
+
cisIds?: string[];
|
|
16
15
|
gtfsIds?: string[];
|
|
17
16
|
names?: string[];
|
|
18
17
|
total: number;
|
|
@@ -94,15 +94,9 @@ class PIDDepartureBoardsModel {
|
|
|
94
94
|
throw new golemio_errors_1.CustomError("Database error", true, "DepartureBoardsModel", 500, err);
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
|
-
this.ropidVYMIEventsModel = new _1.RopidVYMIEventsModel();
|
|
98
97
|
this.ropidVYMIEventsStopsModel = new _1.RopidVYMIEventsStopsModel();
|
|
99
98
|
this.ropidDeparturesDirectionsModel = new _1.RopidDeparturesDirectionsModel();
|
|
100
99
|
this.ropidDeparturesModel = new RopidDeparturesModel_1.RopidDeparturesModel();
|
|
101
|
-
this.ropidVYMIEventsStopsModel.sequelizeModel.belongsTo(this.ropidVYMIEventsModel.sequelizeModel, {
|
|
102
|
-
as: "event",
|
|
103
|
-
targetKey: "vymi_id",
|
|
104
|
-
foreignKey: "event_id",
|
|
105
|
-
});
|
|
106
100
|
}
|
|
107
101
|
}
|
|
108
102
|
exports.PIDDepartureBoardsModel = PIDDepartureBoardsModel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PIDDepartureBoardsModel.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/models/PIDDepartureBoardsModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6EAAuE;AACvE,gGAA2E;AAC3E,oDAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"PIDDepartureBoardsModel.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/models/PIDDepartureBoardsModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6EAAuE;AACvE,gGAA2E;AAC3E,oDAA+C;AAC/C,wBAA8E;AAC9E,0BAAkG;AAElG,iEAA8D;AAC9D,qEAAkE;AAClE,+FAA6F;AAE7F,oFAA6D;AAE7D,MAAM,uBAAuB;IAMzB;QALQ,kBAAa,GAAG,GAAG,CAAC;QAW5B;;;WAGG;QACI,WAAM,GAAG,CAAO,OAgBtB,EAAgB,EAAE;;YACf,iCAAiC;YACjC,MAAM,aAAa,GAAG,IAAA,yBAAM,GAAE,CAAC;YAC/B,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7F,MAAM,IAAI,GAAI,OAAO,CAAC,IAAsB,IAAI,iBAAa,CAAC,UAAU,CAAC;YACzE,MAAM,KAAK,GAAI,OAAO,CAAC,KAAwB,IAAI,kBAAc,CAAC,IAAI,CAAC;YACvE,MAAM,MAAM,GAAI,OAAO,CAAC,MAA0B,IAAI,mBAAe,CAAC,IAAI,CAAC;YAC3E,MAAM,IAAI,GAAI,OAAO,CAAC,IAAwB,IAAK,EAAsB,CAAC;YAE1E,MAAM,SAAS,GAAG,IAAA,gCAAe,EAAC,oBAAoB,EAAE,eAAM,CAAC,SAAS,CAAC,CAAC;YAC1E,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,aAAa,CAAC,gCAAK,OAA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8B,EAAE,CAAC;QAC3E,IAAI,CAAC,oBAAoB,GAAG,IAAI,2CAAoB,EAAE,CAAC;IAC3D,CAAC;CAuGJ;AAEQ,0DAAuB"}
|
|
@@ -1,28 +1,12 @@
|
|
|
1
1
|
import { SequelizeModel } from "@golemio/core/dist/output-gateway";
|
|
2
2
|
import { IRopidDeparturesDirectionsOutput } from "../../../schema-definitions/ropid-departures-directions";
|
|
3
3
|
/**
|
|
4
|
-
* Custom Postgres model for Ropid
|
|
4
|
+
* Custom Postgres model for Ropid Departures Directions
|
|
5
5
|
*/
|
|
6
6
|
export declare class RopidDeparturesDirectionsModel extends SequelizeModel {
|
|
7
7
|
constructor();
|
|
8
8
|
GetOne(id: any): Promise<any>;
|
|
9
|
-
/** Convert joined stops attributes to root infotext element
|
|
10
|
-
*
|
|
11
|
-
* @param {IInfotextsStopsModel} item - One infotext record with joined stops from DB
|
|
12
|
-
* @returns {IInfotextsStopsOutputModel} Transformed result
|
|
13
|
-
*/
|
|
14
9
|
private convertItem;
|
|
15
|
-
/** Converts each item one by one
|
|
16
|
-
*
|
|
17
|
-
* @param {IInfotextsStopsModel[]} items - Array of items to be converted
|
|
18
|
-
* @returns {IInfotextsStopsOutputModel[]} Array of final infotexts
|
|
19
|
-
*/
|
|
20
10
|
private convertItems;
|
|
21
|
-
/** Retrieves all infotexts, could be inner joined with set of stops
|
|
22
|
-
*
|
|
23
|
-
* @param {string[]} stopsIds - Array of GTFS stop ids to be inner joined with corresponding infotexts
|
|
24
|
-
* @param {Moment} timeFrom - Timestamp to filter out specified expiration_date column greater than this value
|
|
25
|
-
* @returns {Promise<IInfotextsStopsOutputModel[]>} Array of the retrieved records
|
|
26
|
-
*/
|
|
27
11
|
GetAll(stopsIds: string[]): Promise<IRopidDeparturesDirectionsOutput[]>;
|
|
28
12
|
}
|
|
@@ -18,25 +18,15 @@ const ropid_departures_directions_1 = require("../../../schema-definitions/ropid
|
|
|
18
18
|
const lodash_1 = __importDefault(require("lodash"));
|
|
19
19
|
const sequelize_1 = __importDefault(require("@golemio/core/dist/shared/sequelize"));
|
|
20
20
|
/**
|
|
21
|
-
* Custom Postgres model for Ropid
|
|
21
|
+
* Custom Postgres model for Ropid Departures Directions
|
|
22
22
|
*/
|
|
23
23
|
class RopidDeparturesDirectionsModel extends output_gateway_1.SequelizeModel {
|
|
24
24
|
constructor() {
|
|
25
25
|
super(ropid_departures_directions_1.RopidDeparturesDirections.departureDirections.name + "Model", ropid_departures_directions_1.RopidDeparturesDirections.departureDirections.pgTableName, ropid_departures_directions_1.RopidDeparturesDirections.departureDirections.outputSequelizeAttributes, { schema: ropid_departures_directions_1.RopidDeparturesDirections.pgSchema });
|
|
26
|
-
/** Convert joined stops attributes to root infotext element
|
|
27
|
-
*
|
|
28
|
-
* @param {IInfotextsStopsModel} item - One infotext record with joined stops from DB
|
|
29
|
-
* @returns {IInfotextsStopsOutputModel} Transformed result
|
|
30
|
-
*/
|
|
31
26
|
this.convertItem = (item) => {
|
|
32
27
|
// converting types
|
|
33
28
|
return Object.assign(Object.assign({}, item), { next_stop_id_regexp: new RegExp(item.next_stop_id_regexp), direction: item.direction });
|
|
34
29
|
};
|
|
35
|
-
/** Converts each item one by one
|
|
36
|
-
*
|
|
37
|
-
* @param {IInfotextsStopsModel[]} items - Array of items to be converted
|
|
38
|
-
* @returns {IInfotextsStopsOutputModel[]} Array of final infotexts
|
|
39
|
-
*/
|
|
40
30
|
this.convertItems = (items) => {
|
|
41
31
|
return items.map((item) => this.convertItem(item));
|
|
42
32
|
};
|
|
@@ -44,12 +34,6 @@ class RopidDeparturesDirectionsModel extends output_gateway_1.SequelizeModel {
|
|
|
44
34
|
GetOne(id) {
|
|
45
35
|
throw new Error("Method not implemented.");
|
|
46
36
|
}
|
|
47
|
-
/** Retrieves all infotexts, could be inner joined with set of stops
|
|
48
|
-
*
|
|
49
|
-
* @param {string[]} stopsIds - Array of GTFS stop ids to be inner joined with corresponding infotexts
|
|
50
|
-
* @param {Moment} timeFrom - Timestamp to filter out specified expiration_date column greater than this value
|
|
51
|
-
* @returns {Promise<IInfotextsStopsOutputModel[]>} Array of the retrieved records
|
|
52
|
-
*/
|
|
53
37
|
GetAll(stopsIds) {
|
|
54
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
39
|
if (lodash_1.default.isEmpty(stopsIds)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RopidDeparturesDirectionsModel.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/models/RopidDeparturesDirectionsModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sEAAmE;AACnE,yGAK0C;AAC1C,oDAAuB;AACvB,oFAA4D;AAE5D;;GAEG;AACH,MAAa,8BAA+B,SAAQ,+BAAc;IAC9D;QACI,KAAK,CACD,uDAAyB,CAAC,mBAAmB,CAAC,IAAI,GAAG,OAAO,EAC5D,uDAAyB,CAAC,mBAAmB,CAAC,WAAW,EACzD,uDAAyB,CAAC,mBAAmB,CAAC,yBAAyB,EACvE,EAAE,MAAM,EAAE,uDAAyB,CAAC,QAAQ,EAAE,CACjD,CAAC;
|
|
1
|
+
{"version":3,"file":"RopidDeparturesDirectionsModel.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/models/RopidDeparturesDirectionsModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sEAAmE;AACnE,yGAK0C;AAC1C,oDAAuB;AACvB,oFAA4D;AAE5D;;GAEG;AACH,MAAa,8BAA+B,SAAQ,+BAAc;IAC9D;QACI,KAAK,CACD,uDAAyB,CAAC,mBAAmB,CAAC,IAAI,GAAG,OAAO,EAC5D,uDAAyB,CAAC,mBAAmB,CAAC,WAAW,EACzD,uDAAyB,CAAC,mBAAmB,CAAC,yBAAyB,EACvE,EAAE,MAAM,EAAE,uDAAyB,CAAC,QAAQ,EAAE,CACjD,CAAC;QAOE,gBAAW,GAAG,CAAC,IAA0C,EAAoC,EAAE;YACnG,mBAAmB;YACnB,OAAO,gCACA,IAAI,KACP,mBAAmB,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,EACzD,SAAS,EAAE,IAAI,CAAC,SAAqC,GACpB,CAAC;QAC1C,CAAC,CAAC;QAEM,iBAAY,GAAG,CAAC,KAA6C,EAAsC,EAAE;YACzG,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QACvD,CAAC,CAAC;IAjBF,CAAC;IAED,MAAM,CAAC,EAAO;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAeK,MAAM,CAAC,QAAkB;;YAC3B,IAAI,gBAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;gBACrB,OAAO,EAAwC,CAAC;aACnD;YACD,OAAO,IAAI,CAAC,YAAY,CACpB,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBAC/B,KAAK,EAAE;oBACH,iBAAiB,EAAE;wBACf,CAAC,mBAAS,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ;qBAC9B;iBACJ;gBACD,KAAK,EAAE;oBACH,CAAC,mBAAmB,EAAE,KAAK,CAAC;oBAC5B,CAAC,YAAY,EAAE,KAAK,CAAC;iBACxB;gBACD,GAAG,EAAE,IAAI;aACZ,CAAC,CAA2C,CAChD,CAAC;QACN,CAAC;KAAA;CACJ;AA9CD,wEA8CC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SequelizeModel } from "@golemio/core/dist/output-gateway";
|
|
2
|
+
/**
|
|
3
|
+
* Custom Postgres model for Ropid VYMI Events Routes
|
|
4
|
+
*/
|
|
5
|
+
export declare class RopidVYMIEventsRoutesModel extends SequelizeModel {
|
|
6
|
+
GetAll(options?: any): Promise<any>;
|
|
7
|
+
GetOne(id: any): Promise<any>;
|
|
8
|
+
constructor();
|
|
9
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RopidVYMIEventsRoutesModel = void 0;
|
|
4
|
+
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
5
|
+
const ropid_vymi_1 = require("../../../schema-definitions/ropid-vymi");
|
|
6
|
+
/**
|
|
7
|
+
* Custom Postgres model for Ropid VYMI Events Routes
|
|
8
|
+
*/
|
|
9
|
+
class RopidVYMIEventsRoutesModel extends output_gateway_1.SequelizeModel {
|
|
10
|
+
GetAll(options) {
|
|
11
|
+
throw new Error("Method not implemented.");
|
|
12
|
+
}
|
|
13
|
+
GetOne(id) {
|
|
14
|
+
throw new Error("Method not implemented.");
|
|
15
|
+
}
|
|
16
|
+
constructor() {
|
|
17
|
+
super(ropid_vymi_1.RopidVYMI.eventsRoutes.name + "Model", ropid_vymi_1.RopidVYMI.eventsRoutes.pgTableName, ropid_vymi_1.RopidVYMI.eventsRoutes.outputSequelizeAttributes, { schema: ropid_vymi_1.RopidVYMI.pgSchema });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.RopidVYMIEventsRoutesModel = RopidVYMIEventsRoutesModel;
|
|
21
|
+
//# sourceMappingURL=RopidVYMIEventsRoutesModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RopidVYMIEventsRoutesModel.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/models/RopidVYMIEventsRoutesModel.ts"],"names":[],"mappings":";;;AAAA,sEAAmE;AACnE,uEAA4C;AAE5C;;GAEG;AACH,MAAa,0BAA2B,SAAQ,+BAAc;IAC1D,MAAM,CAAC,OAAa;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IACD,MAAM,CAAC,EAAO;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAED;QACI,KAAK,CACD,sBAAS,CAAC,YAAY,CAAC,IAAI,GAAG,OAAO,EACrC,sBAAS,CAAC,YAAY,CAAC,WAAW,EAClC,sBAAS,CAAC,YAAY,CAAC,yBAAyB,EAChD,EAAE,MAAM,EAAE,sBAAS,CAAC,QAAQ,EAAE,CACjC,CAAC;IACN,CAAC;CACJ;AAhBD,gEAgBC"}
|
|
@@ -4,38 +4,48 @@ export declare enum InfotextsDisplayTypeEnum {
|
|
|
4
4
|
INLINE = "inline",
|
|
5
5
|
GENERAL = "general"
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
display_type: InfotextsDisplayTypeEnum;
|
|
7
|
+
interface IInfotextsStopsWithEventModel {
|
|
9
8
|
valid_from: string | null;
|
|
10
9
|
valid_to: string | null;
|
|
11
10
|
text: string;
|
|
12
|
-
|
|
11
|
+
stop_type: number;
|
|
13
12
|
related_stops: string[];
|
|
14
13
|
}
|
|
14
|
+
interface IInfotextsStopsWithRoutesModel extends IInfotextsStopsWithEventModel {
|
|
15
|
+
expiration_date: string | null;
|
|
16
|
+
last_updated: string;
|
|
17
|
+
related_routes: string[];
|
|
18
|
+
}
|
|
19
|
+
interface IInfotextsStopsWithEventOutputModel extends Omit<IInfotextsStopsWithEventModel, "stop_type"> {
|
|
20
|
+
display_type: InfotextsDisplayTypeEnum;
|
|
21
|
+
text_en: null;
|
|
22
|
+
}
|
|
23
|
+
interface IInfotextsStopsWithRoutesOutputModel extends Omit<IInfotextsStopsWithRoutesModel, "stop_type"> {
|
|
24
|
+
display_type: InfotextsDisplayTypeEnum;
|
|
25
|
+
text_en: null;
|
|
26
|
+
}
|
|
15
27
|
/**
|
|
16
28
|
* Custom Postgres model for Ropid VYMI Events
|
|
17
29
|
*/
|
|
18
30
|
export declare class RopidVYMIEventsStopsModel extends SequelizeModel {
|
|
31
|
+
private static LAST_UPDATED_DATE_TIME_FORMAT;
|
|
32
|
+
private readonly eventsModel;
|
|
33
|
+
private readonly eventsRoutesModel;
|
|
19
34
|
GetAll(options?: any): Promise<any>;
|
|
20
35
|
GetOne(id: any): Promise<any>;
|
|
21
36
|
constructor();
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
* @param {IInfotextsStopsModel} item - One infotext record with joined stops from DB
|
|
25
|
-
* @returns {IInfotextsStopsOutputModel} Transformed result
|
|
26
|
-
*/
|
|
27
|
-
private convertItem;
|
|
28
|
-
/** Converts each item one by one
|
|
29
|
-
*
|
|
30
|
-
* @param {IInfotextsStopsModel[]} items - Array of items to be converted
|
|
31
|
-
* @returns {IInfotextsStopsOutputModel[]} Array of final infotexts
|
|
32
|
-
*/
|
|
33
|
-
private convertItems;
|
|
34
|
-
/** Retrieves all infotexts, could be inner joined with set of stops
|
|
37
|
+
/** Retrieves all infotexts with event, could be inner joined with set of stops
|
|
35
38
|
*
|
|
36
39
|
* @param {string[]} stopsIds - Array of GTFS stop ids to be inner joined with corresponding infotexts
|
|
37
40
|
* @param {Moment} timeFrom - Timestamp to filter out specified expiration_date column greater than this value
|
|
38
|
-
* @returns {Promise<IInfotextsStopsOutputModel[]>} Array of the retrieved records
|
|
39
41
|
*/
|
|
40
|
-
GetAllDistinctWithEvents: (stopsIds: string[], timeFrom: moment.Moment | undefined, timezone: string) => Promise<
|
|
42
|
+
GetAllDistinctWithEvents: (stopsIds: string[], timeFrom: moment.Moment | undefined, timezone: string) => Promise<IInfotextsStopsWithEventOutputModel[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Retrieve all infotexts with routes
|
|
45
|
+
*/
|
|
46
|
+
GetAllWithRoutes: (timezone: string) => Promise<IInfotextsStopsWithRoutesOutputModel[]>;
|
|
47
|
+
private mapDataWithEvent;
|
|
48
|
+
private mapDataWithRoutes;
|
|
49
|
+
private mapStopTypeToDisplayType;
|
|
41
50
|
}
|
|
51
|
+
export {};
|
|
@@ -27,9 +27,9 @@ exports.RopidVYMIEventsStopsModel = exports.InfotextsDisplayTypeEnum = void 0;
|
|
|
27
27
|
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
|
|
28
28
|
const ropid_vymi_1 = require("../../../schema-definitions/ropid-vymi");
|
|
29
29
|
const shared_1 = require("../../shared");
|
|
30
|
+
const models_1 = require("./");
|
|
30
31
|
const moment_timezone_1 = __importDefault(require("@golemio/core/dist/shared/moment-timezone"));
|
|
31
32
|
const sequelize_1 = __importDefault(require("@golemio/core/dist/shared/sequelize"));
|
|
32
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
33
33
|
var InfotextsRecordTypeEnum;
|
|
34
34
|
(function (InfotextsRecordTypeEnum) {
|
|
35
35
|
InfotextsRecordTypeEnum[InfotextsRecordTypeEnum["EXCEPTION"] = 1] = "EXCEPTION";
|
|
@@ -47,36 +47,16 @@ var InfotextsDisplayTypeEnum;
|
|
|
47
47
|
class RopidVYMIEventsStopsModel extends output_gateway_1.SequelizeModel {
|
|
48
48
|
constructor() {
|
|
49
49
|
super(ropid_vymi_1.RopidVYMI.eventsStops.name + "Model", ropid_vymi_1.RopidVYMI.eventsStops.pgTableName, ropid_vymi_1.RopidVYMI.eventsStops.outputSequelizeAttributes, { schema: ropid_vymi_1.RopidVYMI.pgSchema });
|
|
50
|
-
/**
|
|
51
|
-
*
|
|
52
|
-
* @param {IInfotextsStopsModel} item - One infotext record with joined stops from DB
|
|
53
|
-
* @returns {IInfotextsStopsOutputModel} Transformed result
|
|
54
|
-
*/
|
|
55
|
-
this.convertItem = (item, timezone) => {
|
|
56
|
-
// excluding event.id from result
|
|
57
|
-
// stop type 1 and 9 leads to general infotext type
|
|
58
|
-
const { "event.id": eventId, stop_type: stopType, valid_from, valid_to } = item, infotextsStopModel = __rest(item, ["event.id", "stop_type", "valid_from", "valid_to"]);
|
|
59
|
-
return Object.assign(Object.assign({ display_type: stopType === 1 || stopType === 9 ? InfotextsDisplayTypeEnum.GENERAL : InfotextsDisplayTypeEnum.INLINE, text_en: null }, infotextsStopModel), { valid_from: shared_1.RopidRouterUtils.formatTimestamp(valid_from, timezone), valid_to: shared_1.RopidRouterUtils.formatTimestamp(valid_to, timezone) });
|
|
60
|
-
};
|
|
61
|
-
/** Converts each item one by one
|
|
62
|
-
*
|
|
63
|
-
* @param {IInfotextsStopsModel[]} items - Array of items to be converted
|
|
64
|
-
* @returns {IInfotextsStopsOutputModel[]} Array of final infotexts
|
|
65
|
-
*/
|
|
66
|
-
this.convertItems = (items, timezone) => {
|
|
67
|
-
return items.map((item) => this.convertItem(item, timezone));
|
|
68
|
-
};
|
|
69
|
-
/** Retrieves all infotexts, could be inner joined with set of stops
|
|
50
|
+
/** Retrieves all infotexts with event, could be inner joined with set of stops
|
|
70
51
|
*
|
|
71
52
|
* @param {string[]} stopsIds - Array of GTFS stop ids to be inner joined with corresponding infotexts
|
|
72
53
|
* @param {Moment} timeFrom - Timestamp to filter out specified expiration_date column greater than this value
|
|
73
|
-
* @returns {Promise<IInfotextsStopsOutputModel[]>} Array of the retrieved records
|
|
74
54
|
*/
|
|
75
55
|
this.GetAllDistinctWithEvents = (stopsIds, timeFrom = (0, moment_timezone_1.default)(), timezone) => __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
if (
|
|
56
|
+
if (stopsIds.length < 1) {
|
|
77
57
|
return [];
|
|
78
58
|
}
|
|
79
|
-
|
|
59
|
+
const data = yield this.sequelizeModel.findAll({
|
|
80
60
|
attributes: [
|
|
81
61
|
"valid_from",
|
|
82
62
|
"valid_to",
|
|
@@ -85,7 +65,7 @@ class RopidVYMIEventsStopsModel extends output_gateway_1.SequelizeModel {
|
|
|
85
65
|
[sequelize_1.default.fn("ARRAY_AGG", sequelize_1.default.col("gtfs_stop_id")), "related_stops"],
|
|
86
66
|
],
|
|
87
67
|
include: {
|
|
88
|
-
attributes: [
|
|
68
|
+
attributes: [],
|
|
89
69
|
as: "event",
|
|
90
70
|
model: output_gateway_1.sequelizeConnection.models[ropid_vymi_1.RopidVYMI.events.pgTableName],
|
|
91
71
|
where: {
|
|
@@ -107,7 +87,85 @@ class RopidVYMIEventsStopsModel extends output_gateway_1.SequelizeModel {
|
|
|
107
87
|
},
|
|
108
88
|
group: ["valid_from", "valid_to", "text", "stop_type", "event.vymi_id"],
|
|
109
89
|
raw: true,
|
|
110
|
-
})
|
|
90
|
+
});
|
|
91
|
+
return this.mapDataWithEvent(data, timezone);
|
|
92
|
+
});
|
|
93
|
+
/**
|
|
94
|
+
* Retrieve all infotexts with routes
|
|
95
|
+
*/
|
|
96
|
+
this.GetAllWithRoutes = (timezone) => __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
const data = yield this.sequelizeModel.findAll({
|
|
98
|
+
attributes: [
|
|
99
|
+
"valid_from",
|
|
100
|
+
"valid_to",
|
|
101
|
+
"text",
|
|
102
|
+
"stop_type",
|
|
103
|
+
[sequelize_1.default.literal("event.expiration_date"), "expiration_date"],
|
|
104
|
+
[sequelize_1.default.literal("event.pa_03"), "last_updated"],
|
|
105
|
+
[sequelize_1.default.literal("ARRAY_AGG(DISTINCT gtfs_stop_id)"), "related_stops"],
|
|
106
|
+
[sequelize_1.default.literal("ARRAY_REMOVE(ARRAY_AGG(DISTINCT route.gtfs_route_id), NULL)"), "related_routes"],
|
|
107
|
+
],
|
|
108
|
+
include: [
|
|
109
|
+
{
|
|
110
|
+
attributes: [],
|
|
111
|
+
as: "event",
|
|
112
|
+
model: output_gateway_1.sequelizeConnection.models[ropid_vymi_1.RopidVYMI.events.pgTableName],
|
|
113
|
+
where: {
|
|
114
|
+
time_from: {
|
|
115
|
+
[sequelize_1.default.Op.lte]: new Date().toISOString(),
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
attributes: [],
|
|
121
|
+
as: "route",
|
|
122
|
+
model: output_gateway_1.sequelizeConnection.models[ropid_vymi_1.RopidVYMI.eventsRoutes.pgTableName],
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
where: {
|
|
126
|
+
text: {
|
|
127
|
+
[sequelize_1.default.Op.and]: [{ [sequelize_1.default.Op.ne]: null }, { [sequelize_1.default.Op.ne]: "" }],
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
group: [
|
|
131
|
+
"ropidvymi_events_stops.valid_from",
|
|
132
|
+
"ropidvymi_events_stops.valid_to",
|
|
133
|
+
"ropidvymi_events_stops.text",
|
|
134
|
+
"stop_type",
|
|
135
|
+
"event.vymi_id",
|
|
136
|
+
],
|
|
137
|
+
raw: true,
|
|
138
|
+
});
|
|
139
|
+
return this.mapDataWithRoutes(data, timezone);
|
|
140
|
+
});
|
|
141
|
+
this.mapDataWithEvent = (items, timezone) => {
|
|
142
|
+
return items.map((item) => {
|
|
143
|
+
const { stop_type: stopType, valid_from, valid_to } = item, infotextsStopModel = __rest(item, ["stop_type", "valid_from", "valid_to"]);
|
|
144
|
+
return Object.assign(Object.assign({ display_type: this.mapStopTypeToDisplayType(stopType), text_en: null }, infotextsStopModel), { valid_from: shared_1.RopidRouterUtils.formatTimestamp(valid_from, timezone), valid_to: shared_1.RopidRouterUtils.formatTimestamp(valid_to, timezone) });
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
this.mapDataWithRoutes = (items, timezone) => {
|
|
148
|
+
return items.map((item) => {
|
|
149
|
+
const { stop_type: stopType, expiration_date, last_updated, valid_from, valid_to } = item, infotextsStopModel = __rest(item, ["stop_type", "expiration_date", "last_updated", "valid_from", "valid_to"]);
|
|
150
|
+
const lastUpdatedDateTime = moment_timezone_1.default.tz(last_updated, RopidVYMIEventsStopsModel.LAST_UPDATED_DATE_TIME_FORMAT, timezone);
|
|
151
|
+
return Object.assign(Object.assign({ display_type: this.mapStopTypeToDisplayType(stopType), text_en: null }, infotextsStopModel), { expiration_date: shared_1.RopidRouterUtils.formatTimestamp(expiration_date, timezone), last_updated: shared_1.RopidRouterUtils.formatTimestamp(lastUpdatedDateTime, timezone), valid_from: shared_1.RopidRouterUtils.formatTimestamp(valid_from, timezone), valid_to: shared_1.RopidRouterUtils.formatTimestamp(valid_to, timezone) });
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
this.mapStopTypeToDisplayType = (stopType) => {
|
|
155
|
+
// stop type 1 and 9 leads to general infotext type
|
|
156
|
+
return stopType === 1 || stopType === 9 ? InfotextsDisplayTypeEnum.GENERAL : InfotextsDisplayTypeEnum.INLINE;
|
|
157
|
+
};
|
|
158
|
+
this.eventsModel = new models_1.RopidVYMIEventsModel();
|
|
159
|
+
this.eventsRoutesModel = new models_1.RopidVYMIEventsRoutesModel();
|
|
160
|
+
this.sequelizeModel.belongsTo(this.eventsModel.sequelizeModel, {
|
|
161
|
+
as: "event",
|
|
162
|
+
targetKey: "vymi_id",
|
|
163
|
+
foreignKey: "event_id",
|
|
164
|
+
});
|
|
165
|
+
this.sequelizeModel.hasMany(this.eventsRoutesModel.sequelizeModel, {
|
|
166
|
+
as: "route",
|
|
167
|
+
foreignKey: "event_id",
|
|
168
|
+
sourceKey: "event_id",
|
|
111
169
|
});
|
|
112
170
|
}
|
|
113
171
|
GetAll(options) {
|
|
@@ -118,4 +176,5 @@ class RopidVYMIEventsStopsModel extends output_gateway_1.SequelizeModel {
|
|
|
118
176
|
}
|
|
119
177
|
}
|
|
120
178
|
exports.RopidVYMIEventsStopsModel = RopidVYMIEventsStopsModel;
|
|
179
|
+
RopidVYMIEventsStopsModel.LAST_UPDATED_DATE_TIME_FORMAT = "YYYYMMDD HH:mm:ss";
|
|
121
180
|
//# sourceMappingURL=RopidVYMIEventsStopsModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RopidVYMIEventsStopsModel.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/models/RopidVYMIEventsStopsModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAwF;AACxF,uEAA4C;AAC5C,yCAA8C;AAC9C,gGAA2E;AAC3E,oFAA4D;
|
|
1
|
+
{"version":3,"file":"RopidVYMIEventsStopsModel.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/models/RopidVYMIEventsStopsModel.ts"],"names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AE,QAAQ,CAAC,IAChE;YACN,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QAEM,6BAAwB,GAAG,CAAC,QAAgB,EAA4B,EAAE;YAC9E,mDAAmD;YACnD,OAAO,QAAQ,KAAK,CAAC,IAAI,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC,MAAM,CAAC;QACjH,CAAC,CAAC;QA/JE,IAAI,CAAC,WAAW,GAAG,IAAI,6BAAoB,EAAE,CAAC;QAC9C,IAAI,CAAC,iBAAiB,GAAG,IAAI,mCAA0B,EAAE,CAAC;QAE1D,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE;YAC3D,EAAE,EAAE,OAAO;YACX,SAAS,EAAE,SAAS;YACpB,UAAU,EAAE,UAAU;SACzB,CAAC,CAAC;QAEH,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE;YAC/D,EAAE,EAAE,OAAO;YACX,UAAU,EAAE,UAAU;YACtB,SAAS,EAAE,UAAU;SACxB,CAAC,CAAC;IACP,CAAC;IA7BD,MAAM,CAAC,OAAa;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IACD,MAAM,CAAC,EAAO;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;;AAVL,8DAoLC;AAnLkB,uDAA6B,GAAG,mBAAmB,CAAC"}
|
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./PIDDepartureBoardsModel"), exports);
|
|
18
18
|
__exportStar(require("./RopidVYMIEventsModel"), exports);
|
|
19
|
+
__exportStar(require("./RopidVYMIEventsRoutesModel"), exports);
|
|
19
20
|
__exportStar(require("./RopidVYMIEventsStopsModel"), exports);
|
|
20
21
|
__exportStar(require("./RopidDeparturesDirectionsModel"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,yDAAuC;AACvC,8DAA4C;AAC5C,mEAAiD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/output-gateway/pid/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,yDAAuC;AACvC,+DAA6C;AAC7C,8DAA4C;AAC5C,mEAAiD"}
|