UNPKG

@golemio/parkings

Version:
31 lines 1.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ParkingSourcesController = void 0; 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"); const InputParkingSourceSchema_1 = require("../../schema-definitions/datasources/InputParkingSourceSchema"); class ParkingSourcesController extends controllers_1.BaseController { constructor() { super("ParkingSources", new golemio_validator_1.JSONSchemaValidator("ParkingSource", InputParkingSourceSchema_1.InputParkingSourceSchema)); this.processData = async (inputData) => { try { await this.validator.Validate(inputData); const queue = "input." + this.queuePrefix + ".updateParkingSource"; 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.ParkingSourcesController = ParkingSourcesController; //# sourceMappingURL=ParkingSourcesController.js.map