@golemio/pid
Version:
Golemio PID Module
57 lines • 4.49 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PrecomputedTablesFacade = void 0;
const RopidGtfsRepository_1 = require("../../../../data-access/RopidGtfsRepository");
const DeparturesRepository_1 = require("../../../../data-access/precomputed/DeparturesRepository");
const MinMaxStopSequencesRepository_1 = require("../../../../data-access/precomputed/MinMaxStopSequencesRepository");
const ServicesCalendarRepository_1 = require("../../../../data-access/precomputed/ServicesCalendarRepository");
const TripScheduleRepository_1 = require("../../../../data-access/precomputed/TripScheduleRepository");
const SourceTableSuffixEnum_1 = require("../../../../helpers/SourceTableSuffixEnum");
const RopidGtfsContainerToken_1 = require("../../../../ioc/RopidGtfsContainerToken");
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
let PrecomputedTablesFacade = exports.PrecomputedTablesFacade = class PrecomputedTablesFacade {
constructor(logger, ropidGtfsRepository, departureRepository) {
this.logger = logger;
this.ropidGtfsRepository = ropidGtfsRepository;
this.departureRepository = departureRepository;
this.createAndPopulatePrecomputedTmpTables = async (sourceTableSuffix) => {
await this.ropidGtfsRepository.createPrecomputedTmpTables();
this.logger.info(`Datasets: populating temp table ${this.servicesCalendarRepository["tableName"]}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp}`);
await this.servicesCalendarRepository.populate(sourceTableSuffix);
this.logger.info(`Datasets: populating temp table ${this.minMaxStopSequencesRepository["tableName"]}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp}`);
await this.minMaxStopSequencesRepository.populate(sourceTableSuffix);
this.logger.info(`Datasets: populating temp table ${this.tripScheduleRepository["tableName"]}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp}`);
await this.tripScheduleRepository.populate(sourceTableSuffix);
this.logger.info(`Datasets: populating temp table ${this.departureRepository["tableName"]}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp}`);
await this.departureRepository.createAndPopulate(sourceTableSuffix);
this.logger.info(`Datasets: running analyze on ${this.departureRepository["tableName"]}${SourceTableSuffixEnum_1.SourceTableSuffixEnum.Tmp}`);
await this.departureRepository.analyze();
};
/** Precomputed data repositories */
this.minMaxStopSequencesRepository = new MinMaxStopSequencesRepository_1.MinMaxStopSequencesRepository();
this.tripScheduleRepository = new TripScheduleRepository_1.TripScheduleRepository();
this.servicesCalendarRepository = new ServicesCalendarRepository_1.ServicesCalendarRepository();
}
};
exports.PrecomputedTablesFacade = PrecomputedTablesFacade = __decorate([
(0, tsyringe_1.injectable)(),
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
__param(1, (0, tsyringe_1.inject)(RopidGtfsContainerToken_1.RopidGtfsContainerToken.RopidGtfsRepository)),
__param(2, (0, tsyringe_1.inject)(RopidGtfsContainerToken_1.RopidGtfsContainerToken.DepartureRepository)),
__metadata("design:paramtypes", [Object, RopidGtfsRepository_1.RopidGtfsRepository,
DeparturesRepository_1.DeparturesRepository])
], PrecomputedTablesFacade);
//# sourceMappingURL=PrecomputedTablesFacade.js.map