23 lines
813 B
JavaScript
23 lines
813 B
JavaScript
|
|
"use strict";
|
||
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
|
const express_1 = require("express");
|
||
|
|
const jobStore_1 = require("../db/jobStore");
|
||
|
|
const router = (0, express_1.Router)();
|
||
|
|
router.get('/', (_req, res) => {
|
||
|
|
const config = (0, jobStore_1.getAllConfig)();
|
||
|
|
res.json({ config });
|
||
|
|
});
|
||
|
|
router.put('/', (req, res) => {
|
||
|
|
const updates = req.body;
|
||
|
|
if (typeof updates !== 'object' || updates === null) {
|
||
|
|
res.status(400).json({ error: 'Body must be a JSON object of key-value pairs' });
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
for (const [key, value] of Object.entries(updates)) {
|
||
|
|
(0, jobStore_1.setConfigValue)(key, String(value));
|
||
|
|
}
|
||
|
|
const config = (0, jobStore_1.getAllConfig)();
|
||
|
|
res.json({ config });
|
||
|
|
});
|
||
|
|
exports.default = router;
|
||
|
|
//# sourceMappingURL=config.js.map
|