2024-06-15 00:38:12 +02:00
|
|
|
import { RequestHandler } from "express";
|
2024-06-15 02:52:45 +02:00
|
|
|
import { config } 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-12-23 22:44:01 +01:00
|
|
|
const getConfigDataController: RequestHandler = async (req, res) => {
|
|
|
|
const account = await getAccountForRequest(req);
|
|
|
|
if (isAdministrator(account)) {
|
|
|
|
res.json(config);
|
|
|
|
} else {
|
|
|
|
res.status(401).end();
|
|
|
|
}
|
2024-06-15 00:38:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export { getConfigDataController };
|