Create backup folder on setting save

This commit is contained in:
SebClem 2024-08-27 11:34:46 +02:00
parent cd4032cd6f
commit 8b1285780b
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50

View File

@ -9,7 +9,10 @@ import {
saveWebdavConfig,
validateWebdavConfig,
} from "../services/webdavConfigService.js";
import { checkWebdavLogin } from "../services/webdavService.js";
import {
checkWebdavLogin,
createBackupFolder,
} from "../services/webdavService.js";
import type { BackupConfig } from "../types/services/backupConfig.js";
import type { ValidationError } from "joi";
import type { WebdavConfig } from "../types/services/webdavConfig.js";
@ -46,6 +49,9 @@ configRouter.put("/webdav", (req, res) => {
.then(() => {
return checkWebdavLogin(req.body as WebdavConfig, true);
})
.then(() => {
return createBackupFolder(req.body as WebdavConfig);
})
.then(() => {
saveWebdavConfig(req.body as WebdavConfig);
res.status(204).send();