@golemio/parkings
Version:
Golemio Parkings Module
32 lines • 1.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.IsphkParkingController = void 0;
const _sch_1 = require("../../schema-definitions");
const IsphkMeasurementsSchema_1 = require("../../schema-definitions/datasources/isphk/IsphkMeasurementsSchema");
const controllers_1 = require("@golemio/core/dist/input-gateway/controllers");
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
class IsphkParkingController extends controllers_1.BaseController {
constructor() {
super(_sch_1.Parkings.name, new golemio_validator_1.JSONSchemaValidator("ParkingSource", IsphkMeasurementsSchema_1.IsphkMeasurementsSchema));
this.processData = async (inputData) => {
try {
await this.validator.Validate(inputData);
const queue = "input." + this.queuePrefix + ".saveIsphkMeasurements";
await this.sendMessageToExchange(queue, JSON.stringify(inputData), {
persistent: true,
});
}
catch (err) {
if (err instanceof golemio_errors_1.AbstractGolemioError) {
throw err;
}
else {
throw new golemio_errors_1.GeneralError("Error while validating input data.", this.name, err, 422);
}
}
};
}
}
exports.IsphkParkingController = IsphkParkingController;
//# sourceMappingURL=IsphkParkingController.js.map