2024-06-15 00:38:12 +02:00
|
|
|
import { RequestHandler } from "express";
|
2024-06-15 02:52:45 +02:00
|
|
|
import { updateConfig } from "@/src/services/configService";
|
2024-12-23 22:44:01 +01:00
|
|
|
import { getAccountForRequest, isAdministrator } from "@/src/services/loginService";
|
2024-06-15 00:38:12 +02:00
|
|
|
|
2024-06-15 02:52:45 +02:00
|
|
|
const updateConfigDataController: RequestHandler = async (req, res) => {
|
2024-12-23 22:44:01 +01:00
|
|
|
const account = await getAccountForRequest(req);
|
|
|
|
if (isAdministrator(account)) {
|
|
|
|
await updateConfig(String(req.body));
|
|
|
|
res.end();
|
|
|
|
} else {
|
|
|
|
res.status(401).end();
|
|
|
|
}
|
2024-06-15 00:38:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export { updateConfigDataController };
|