diff --git a/nextcloud_backup/backend/src/services/backupConfigService.ts b/nextcloud_backup/backend/src/services/backupConfigService.ts
index 014ed4c..9800809 100644
--- a/nextcloud_backup/backend/src/services/backupConfigService.ts
+++ b/nextcloud_backup/backend/src/services/backupConfigService.ts
@@ -1,7 +1,7 @@
import fs from "fs";
import Joi from "joi";
import logger from "../config/winston.js";
-import type { BackupConfig } from "../types/services/backupConfig.js";
+import { BackupConfig, BackupType } from "../types/services/backupConfig.js";
import backupConfigValidation from "../types/services/backupConfigValidation.js";
const backupConfigPath = "/data/backupConfigV2.json";
@@ -40,10 +40,7 @@ export function getBackupDefaultConfig(): BackupConfig {
enabled: false,
},
},
- exclude: {
- addon: [],
- folder: [],
- },
+ backupType: BackupType.FULL,
autoStopAddon: [],
password: {
enabled: false,
diff --git a/nextcloud_backup/backend/src/types/services/backupConfig.ts b/nextcloud_backup/backend/src/types/services/backupConfig.ts
index 9e17ddf..2c2a3f4 100644
--- a/nextcloud_backup/backend/src/types/services/backupConfig.ts
+++ b/nextcloud_backup/backend/src/types/services/backupConfig.ts
@@ -15,6 +15,11 @@ export enum Weekday {
SATURDAY
}
+export enum BackupType {
+ FULL= "FULL",
+ PARTIAL = "PARTIAL"
+}
+
export interface BackupConfig {
nameTemplate: string;
@@ -22,8 +27,9 @@ export interface BackupConfig {
autoClean: {
homeAssistant: AutoCleanConfig;
webdav: AutoCleanConfig;
- }
- exclude: {
+ },
+ backupType: BackupType;
+ exclude?: {
addon: string[];
folder: string[];
}
diff --git a/nextcloud_backup/backend/src/types/services/backupConfigValidation.ts b/nextcloud_backup/backend/src/types/services/backupConfigValidation.ts
index b0ed4d0..c5a4eeb 100644
--- a/nextcloud_backup/backend/src/types/services/backupConfigValidation.ts
+++ b/nextcloud_backup/backend/src/types/services/backupConfigValidation.ts
@@ -1,5 +1,5 @@
import Joi from "joi";
-import { CronMode } from "./backupConfig.js";
+import { BackupType, CronMode } from "./backupConfig.js";
const CronConfigValidation = {
id: Joi.string().required().not().empty(),
@@ -46,10 +46,17 @@ const backupConfigValidation = {
homeAssistant: Joi.object(AutoCleanConfig).required(),
webdav: Joi.object(AutoCleanConfig).required(),
}).required(),
- exclude: Joi.object({
- addon: Joi.array().items(Joi.string().not().empty()).required(),
- folder: Joi.array().items(Joi.string().not().empty()).required(),
- }).required(),
+ backupType: Joi.string()
+ .required()
+ .valid(BackupType.FULL, BackupType.PARTIAL),
+ exclude: Joi.alternatives().conditional("backupType", {
+ is: BackupType.PARTIAL,
+ then: Joi.object({
+ addon: Joi.array().items(Joi.string().not().empty()).required(),
+ folder: Joi.array().items(Joi.string().not().empty()).required(),
+ }).required(),
+ otherwise: Joi.forbidden(),
+ }),
autoStopAddon: Joi.array().items(Joi.string().not().empty()),
password: Joi.object({
enabled: Joi.boolean().required(),
diff --git a/nextcloud_backup/frontend/src/components/settings/BackupConfig/BackupConfigAddon.vue b/nextcloud_backup/frontend/src/components/settings/BackupConfig/BackupConfigAddon.vue
index 2998f1b..2890c0d 100644
--- a/nextcloud_backup/frontend/src/components/settings/BackupConfig/BackupConfigAddon.vue
+++ b/nextcloud_backup/frontend/src/components/settings/BackupConfig/BackupConfigAddon.vue
@@ -33,6 +33,9 @@ defineProps<{ loading: boolean }>();
const backupConfigStore = useBackupConfigStore();
const { data, addons, invertedAddons } = storeToRefs(backupConfigStore);
watch(invertedAddons, () => {
+ if (!data.value.exclude) {
+ data.value.exclude = { addon: [], folder: [] };
+ }
data.value.exclude.addon = [];
for (const addon of addons.value) {
if (!invertedAddons.value.includes(addon.slug)) {
diff --git a/nextcloud_backup/frontend/src/components/settings/BackupConfigForm.vue b/nextcloud_backup/frontend/src/components/settings/BackupConfigForm.vue
index bd9ed1a..a356e6f 100644
--- a/nextcloud_backup/frontend/src/components/settings/BackupConfigForm.vue
+++ b/nextcloud_backup/frontend/src/components/settings/BackupConfigForm.vue
@@ -30,13 +30,33 @@
-
-
-
-
-
+
+ Backup Type
+
+
+
+
+
+
+
+
+
+
+
+
@@ -81,6 +101,7 @@ import BackupConfigFolder from "./BackupConfig/BackupConfigFolder.vue";
import BackupConfigAutoClean from "./BackupConfig/BackupConfigAutoClean.vue";
import BackupConfigSecurity from "./BackupConfig/BackupConfigSecurity.vue";
import BackupConfigAutoStop from "./BackupConfig/BackupConfigAutoStop.vue";
+import { BackupType } from "@/types/backupConfig";
const backupConfigStore = useBackupConfigStore();
const { data } = storeToRefs(backupConfigStore);
diff --git a/nextcloud_backup/frontend/src/services/configService.ts b/nextcloud_backup/frontend/src/services/configService.ts
index 2027e81..7f44223 100644
--- a/nextcloud_backup/frontend/src/services/configService.ts
+++ b/nextcloud_backup/frontend/src/services/configService.ts
@@ -1,4 +1,4 @@
-import type { BackupConfig } from "@/types/backupConfig";
+import { BackupType, type BackupConfig } from "@/types/backupConfig";
import type { WebdavConfig } from "@/types/webdavConfig";
import kyClient from "./kyClient";
@@ -27,6 +27,12 @@ export function saveBackupConfig(config: BackupConfig) {
}
function cleanupConfig(config: BackupConfig) {
+ if (config.backupType == BackupType.Full) {
+ config.exclude = undefined;
+ } else if (!config.exclude) {
+ config.exclude = { addon: [], folder: [] };
+ }
+
if (!config.autoClean.homeAssistant.enabled) {
config.autoClean.homeAssistant.nbrToKeep = undefined;
}
@@ -34,7 +40,7 @@ function cleanupConfig(config: BackupConfig) {
config.autoClean.webdav.nbrToKeep = undefined;
}
- if (!config.password.enabled){
+ if (!config.password.enabled) {
config.password.value = undefined;
}
return config;
diff --git a/nextcloud_backup/frontend/src/types/backupConfig.ts b/nextcloud_backup/frontend/src/types/backupConfig.ts
index def9f49..1b3bf6a 100644
--- a/nextcloud_backup/frontend/src/types/backupConfig.ts
+++ b/nextcloud_backup/frontend/src/types/backupConfig.ts
@@ -22,6 +22,11 @@ export enum Weekday {
SATURDAY,
}
+export enum BackupType {
+ Full = "FULL",
+ Partial = "PARTIAL",
+}
+
export const weekdayFriendly = [
"Sunday",
"Monday",
@@ -39,7 +44,8 @@ export interface BackupConfig {
homeAssistant: AutoCleanConfig;
webdav: AutoCleanConfig;
};
- exclude: {
+ backupType: BackupType;
+ exclude?: {
addon: string[];
folder: string[];
};