Phase 5.15: Automated backup system with pg_dump, file backup, retention, restore, notifications

This commit is contained in:
Agent Zero
2026-07-23 22:48:19 +02:00
parent 66b6c32ed8
commit 9cfc6bf3b0
5 changed files with 1006 additions and 0 deletions
@@ -34,6 +34,8 @@ class SystemNotifPlugin(BasePlugin):
"user.created",
"workflow.completed",
"notification.created",
"backup.completed",
"backup.failed",
],
migrations=[],
permissions=["system_notif:read"],
@@ -112,6 +114,14 @@ class SystemNotifPlugin(BasePlugin):
"""
await self._create_system_notification(payload, event_type="notification.created")
async def on_backup_completed(self, payload: dict[str, Any]) -> None:
"""Handle backup.completed event → system message."""
await self._create_system_notification(payload, event_type="backup.completed")
async def on_backup_failed(self, payload: dict[str, Any]) -> None:
"""Handle backup.failed event → system message (error)."""
await self._create_system_notification(payload, event_type="backup.failed", severity="error")
async def _create_system_notification(
self,
payload: dict[str, Any],
@@ -155,6 +165,8 @@ class SystemNotifPlugin(BasePlugin):
"user.created": "Neuer Benutzer",
"workflow.completed": "Workflow abgeschlossen",
"notification.created": "Benachrichtigung",
"backup.completed": "Backup erfolgreich",
"backup.failed": "Backup fehlgeschlagen",
}
title = event_titles.get(event_type, event_type)
+8
View File
@@ -29,6 +29,10 @@ class SystemSettingsUpsert(BaseModel):
theme_accent_color: str = Field("#d946ef", max_length=20)
theme_font_family: str = Field("Inter", max_length=100)
theme_border_radius: str = Field("0.5rem", max_length=20)
# Backup configuration
backup_interval: str = Field("daily", max_length=20, description="Backup interval: hourly, daily, weekly, manual")
backup_retention_days: int = Field(7, ge=1, le=365, description="Days to keep backups")
backup_destination: str = Field("local", max_length=20, description="Backup destination: local, s3, nextcloud")
class SystemSettingsResponse(BaseModel):
@@ -56,5 +60,9 @@ class SystemSettingsResponse(BaseModel):
theme_accent_color: str = "#d946ef"
theme_font_family: str = "Inter"
theme_border_radius: str = "0.5rem"
# Backup configuration
backup_interval: str = "daily"
backup_retention_days: int = 7
backup_destination: str = "local"
created_at: str | None = None
updated_at: str | None = None