"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.contactRouter = void 0;
const tslib_1 = require("tslib");
const express_1 = (0, tslib_1.__importDefault)(require("express"));
const emailer_1 = require("../../../lib/emailer");
const redis_1 = require("../../../lib/redis");
const middlewares_1 = require("../../../middlewares");
const contactRouter = express_1.default.Router();
exports.contactRouter = contactRouter;
contactRouter.post('/contact', (0, middlewares_1.asyncMiddleware)(middlewares_1.contactAdministratorValidator), (0, middlewares_1.asyncMiddleware)(contactAdministrator));
function contactAdministrator(req, res) {
    return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
        const data = req.body;
        emailer_1.Emailer.Instance.addContactFormJob(data.fromEmail, data.fromName, data.subject, data.body);
        yield redis_1.Redis.Instance.setContactFormIp(req.ip);
        return res.status(204).end();
    });
}
//# sourceMappingURL=contact.js.map