@golemio/pid
Version:
Golemio PID Module
28 lines • 1.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.JisInfotextsController = void 0;
const JISInfotextsJsonSchema_1 = require("../../schema-definitions/jis/datasources/JISInfotextsJsonSchema");
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 JisInfotextsController extends controllers_1.BaseController {
constructor() {
super("jis", new golemio_validator_1.JSONSchemaValidator("jisInfotextsDataValidation", JISInfotextsJsonSchema_1.jisInfotextsJsonSchema));
this.processData = async (inputData) => {
try {
await this.validator.Validate(inputData);
await this.sendMessageToExchange("input." + this.queuePrefix + ".refreshJISInfotexts", JSON.stringify(inputData));
}
catch (err) {
if (err instanceof golemio_errors_1.AbstractGolemioError) {
throw err;
}
else {
throw new golemio_errors_1.GeneralError("Error while validating input data.", this.constructor.name, err, 422);
}
}
};
}
}
exports.JisInfotextsController = JisInfotextsController;
//# sourceMappingURL=JisInfotextsController.js.map