@golemio/parkings
Version:
Golemio Parkings Module
24 lines • 1.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SaveTskParkingSectionLevelTask = void 0;
const UpdateAddressWorker_1 = require("../UpdateAddressWorker");
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
class SaveTskParkingSectionLevelTask extends integration_engine_1.AbstractEmptyTask {
constructor(queueName, queuePrefix, dataSource, transformation, parkingsLocationRepository, config) {
super(queuePrefix);
this.queueName = queueName;
this.dataSource = dataSource;
this.transformation = transformation;
this.parkingsLocationRepository = parkingsLocationRepository;
this.config = config;
}
async execute() {
const sourceData = await this.dataSource.getAll();
const parkingLocations = this.transformation.transformArray(sourceData);
await this.parkingsLocationRepository.saveWithoutAddress(parkingLocations);
const exchange = this.config.getValue("env.RABBIT_EXCHANGE_NAME");
await integration_engine_1.QueueManager.sendMessageToExchange(exchange + "." + UpdateAddressWorker_1.UpdateAddressWorker.workerName.toLowerCase(), "updateMissingParkingsLocationAddresses", {});
}
}
exports.SaveTskParkingSectionLevelTask = SaveTskParkingSectionLevelTask;
//# sourceMappingURL=SaveTskParkingSectionLevelTask.js.map