mirror of
https://gitlab.com/KKlochko/tui-rsync.git
synced 2026-08-12 17:57:43 +00:00
Add the remove commands.
Fixed deleting to remove destinations with a backup plan.
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
from .remove_all_backup_plans_command import RemoveAllBackupBackupPlansCommand
|
||||
|
||||
__all__ = ['RemoveAllBackupBackupPlansCommand']
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
from tui_rsync.infrastructure.orm.models import BackupPlanModel, DestinationModel
|
||||
|
||||
|
||||
class RemoveAllBackupBackupPlansCommand:
|
||||
def execute(self) -> bool:
|
||||
rows = BackupPlanModel.delete().execute()
|
||||
rows = DestinationModel.delete().execute() + rows
|
||||
return rows != 0
|
||||
+2
-1
@@ -7,7 +7,7 @@ from .backup_plan_repository_port import BackupPlanRepositoryPort
|
||||
from tui_rsync.core.components.backup_plan.domain import BackupPlan
|
||||
from tui_rsync.core.shared_kernel.components.common import UUID
|
||||
|
||||
from tui_rsync.infrastructure.orm.models import BackupPlanModel
|
||||
from tui_rsync.infrastructure.orm.models import BackupPlanModel, DestinationModel
|
||||
|
||||
|
||||
class BackupPlanRepository(BackupPlanRepositoryPort):
|
||||
@@ -34,4 +34,5 @@ class BackupPlanRepository(BackupPlanRepositoryPort):
|
||||
|
||||
def delete(self, uuid: UUID) -> bool:
|
||||
deleted = BackupPlanModel.delete().where(BackupPlanModel.id == uuid.id).execute()
|
||||
deleted = DestinationModel.delete().where(DestinationModel.source == uuid.id).execute() | deleted
|
||||
return bool(deleted)
|
||||
|
||||
Reference in New Issue
Block a user