2024-08-25 13:36:19 +02:00
|
|
|
import { Request, Response } from "express";
|
2025-04-25 08:18:49 +02:00
|
|
|
import SettingHelper from "../helpers/settingsHelper";
|
2024-08-25 13:36:19 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @description Service is currently not configured
|
|
|
|
* @param req {Request} Express req object
|
|
|
|
* @param res {Response} Express res object
|
|
|
|
* @returns {Promise<*>}
|
|
|
|
*/
|
|
|
|
export async function isSetup(req: Request, res: Response): Promise<any> {
|
|
|
|
res.sendStatus(204);
|
|
|
|
}
|
2025-04-25 08:18:49 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @description set club identity
|
|
|
|
* @param req {Request} Express req object
|
|
|
|
* @param res {Response} Express res object
|
|
|
|
* @returns {Promise<*>}
|
|
|
|
*/
|
|
|
|
export async function setClubIdentity(req: Request, res: Response): Promise<any> {
|
|
|
|
const name = req.body.name;
|
|
|
|
const imprint = req.body.imprint;
|
|
|
|
const privacy = req.body.privacy;
|
|
|
|
const website = req.body.website;
|
|
|
|
|
|
|
|
if (name) {
|
|
|
|
await SettingHelper.setSetting("club.name", name);
|
|
|
|
} else {
|
|
|
|
await SettingHelper.resetSetting("club.name");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (imprint) {
|
|
|
|
await SettingHelper.setSetting("club.imprint", imprint);
|
|
|
|
} else {
|
|
|
|
await SettingHelper.resetSetting("club.imprint");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (privacy) {
|
|
|
|
await SettingHelper.setSetting("club.privacy", privacy);
|
|
|
|
} else {
|
|
|
|
await SettingHelper.resetSetting("club.privacy");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (website) {
|
|
|
|
await SettingHelper.setSetting("club.website", website);
|
|
|
|
} else {
|
|
|
|
await SettingHelper.resetSetting("club.website");
|
|
|
|
}
|
|
|
|
|
|
|
|
res.sendStatus(204);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @description set applucation icon and logo
|
|
|
|
* @param req {Request} Express req object
|
|
|
|
* @param res {Response} Express res object
|
|
|
|
* @returns {Promise<*>}
|
|
|
|
*/
|
|
|
|
export async function uploadClubImages(req: Request, res: Response): Promise<any> {
|
|
|
|
if (req.files && !Array.isArray(req.files) && req.files.icon) {
|
|
|
|
await SettingHelper.setSetting("club.icon", "configured");
|
|
|
|
} else {
|
|
|
|
await SettingHelper.resetSetting("club.icon");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (req.files && !Array.isArray(req.files) && req.files.logo) {
|
|
|
|
await SettingHelper.setSetting("club.logo", "configured");
|
|
|
|
} else {
|
|
|
|
await SettingHelper.resetSetting("club.logo");
|
|
|
|
}
|
|
|
|
|
|
|
|
res.sendStatus(204);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @description set app identity
|
|
|
|
* @param req {Request} Express req object
|
|
|
|
* @param res {Response} Express res object
|
|
|
|
* @returns {Promise<*>}
|
|
|
|
*/
|
|
|
|
export async function setAppIdentity(req: Request, res: Response): Promise<any> {
|
|
|
|
const custom_login_message = req.body.custom_login_message;
|
|
|
|
const show_link_to_calendar = req.body.show_link_to_calendar;
|
|
|
|
|
|
|
|
if (custom_login_message) {
|
|
|
|
await SettingHelper.setSetting("app.custom_login_message", custom_login_message);
|
|
|
|
} else {
|
|
|
|
await SettingHelper.resetSetting("app.custom_login_message");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (show_link_to_calendar) {
|
|
|
|
await SettingHelper.setSetting("app.show_link_to_calendar", show_link_to_calendar);
|
|
|
|
} else {
|
|
|
|
await SettingHelper.resetSetting("app.show_link_to_calendar");
|
|
|
|
}
|
|
|
|
|
|
|
|
res.sendStatus(204);
|
|
|
|
}
|