Add command to remove backup plan's destinations.

This commit is contained in:
2025-01-21 21:55:58 +02:00
parent b32e5d32b0
commit bc22e8a8bd
2 changed files with 14 additions and 1 deletions
@@ -1,3 +1,4 @@
from .remove_all_backup_plans_command import RemoveAllBackupBackupPlansCommand
from .remove_backup_plan_destinations_command import RemoveBackupBackupPlanDestinationsCommand
__all__ = ['RemoveAllBackupBackupPlansCommand']
__all__ = ['RemoveAllBackupBackupPlansCommand', 'RemoveBackupBackupPlanDestinationsCommand']
@@ -0,0 +1,12 @@
from tui_rsync.core.ports.orm import DatabaseManagerPort
from tui_rsync.core.shared_kernel.components.common import UUID
from tui_rsync.infrastructure.orm.models import DestinationModel
class RemoveBackupBackupPlanDestinationsCommand:
def __init__(self, database_manager: DatabaseManagerPort):
self.databaseManager = database_manager
def execute(self, backup_plan_uuid: UUID) -> bool:
rows = DestinationModel.delete().where(DestinationModel.source == backup_plan_uuid.id).execute()
return rows != 0