UNPKG

@golemio/parkings

Version:
33 lines 1.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.KoridParkingsDataController = void 0; const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors"); const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator"); const controllers_1 = require("@golemio/core/dist/input-gateway/controllers"); const index_1 = require("../../schema-definitions/index"); class KoridParkingsDataController extends controllers_1.BaseController { constructor() { super(index_1.Parkings.name, new golemio_validator_1.JSONSchemaValidator(index_1.Parkings.korid.name, index_1.Parkings.korid.datasourceJsonSchema)); /** * Data processing */ this.processData = async (inputData) => { try { await this.validator.Validate(inputData); // throws an error await this.sendMessageToExchange("input." + this.queuePrefix + ".saveKoridDataToDB", 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.KoridParkingsDataController = KoridParkingsDataController; //# sourceMappingURL=KoridParkingsDataController.js.map