Update the remove all backup plans command.

Refactor the commands names.
Add the service to remove all plans.
Add tests for remove all command.
This commit is contained in:
2025-01-28 10:40:23 +02:00
parent 76e555aefb
commit 2874dc76ad
11 changed files with 75 additions and 25 deletions
@@ -20,7 +20,7 @@
from rich.console import Console
import typer
from tui_rsync.core.components.backup_plan.application.commands import RemoveAllBackupBackupPlansCommand
from tui_rsync.core.components.backup_plan.application.services import RemoveAllBackupPlansService
from tui_rsync.core.components.backup_plan.application.services.backup_plan_service import BackupPlanService
from tui_rsync.core.shared_kernel.components.common import UUID
from tui_rsync.core.shared_kernel.ports.Exceptions import CommandException
@@ -57,10 +57,9 @@ def all():
[red b]Remove[/] [yellow] all existing backup plans[/].
"""
command: RemoveAllBackupBackupPlansCommand = CurrentConfiguration.get(RemoveAllBackupBackupPlansCommand)
removed = command.execute()
service: RemoveAllBackupPlansService = CurrentConfiguration.get(RemoveAllBackupPlansService)
if removed:
console.print(f"Removed all backup plans.")
if service.remove_all():
console.print("All backup plans removed.")
else:
console.print(f"Nothing to remove. No backup plans.")
console.print("Nothing to remove. No backup plans.")