Add command to remove backup plan's destinations.

dev
KKlochko 3 months ago
parent b32e5d32b0
commit bc22e8a8bd

@ -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
Loading…
Cancel
Save