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
@@ -1,10 +1,10 @@
from injector import singleton, Module, provider
from tui_rsync.core.components.backup_plan.application.commands import RemoveAllBackupBackupPlansCommand
from tui_rsync.core.components.backup_plan.application.commands import RemoveAllBackupPlansCommand
from tui_rsync.core.components.backup_plan.application.queries import GetAllBackupPlansQuery, GetBackupPlanCountQuery
from tui_rsync.core.components.backup_plan.application.repository import BackupPlanRepositoryPort, BackupPlanRepository
from tui_rsync.core.components.backup_plan.application.services import GetBackupPlanCountService, \
GetAllBackupPlansService
GetAllBackupPlansService, RemoveAllBackupPlansService
from tui_rsync.core.components.backup_plan.application.services.backup_plan_service import BackupPlanService
from tui_rsync.core.ports.configuration import UserDataPathsPort
from tui_rsync.core.ports.orm import DatabaseManagerPort
@@ -39,8 +39,13 @@ class Configuration(Module):
@provider
@singleton
def provide_remove_all_backup_plans_command(self, database_manager: DatabaseManagerPort) -> RemoveAllBackupBackupPlansCommand:
return RemoveAllBackupBackupPlansCommand(database_manager)
def provide_remove_all_backup_plans_command(self, database_manager: DatabaseManagerPort) -> RemoveAllBackupPlansCommand:
return RemoveAllBackupPlansCommand(database_manager)
@provider
@singleton
def provide_remove_all_backup_plans_service(self, command: RemoveAllBackupPlansCommand) -> RemoveAllBackupPlansService:
return RemoveAllBackupPlansService(command)
@provider
@singleton
@@ -1,10 +1,10 @@
from injector import singleton, Module, provider
from tui_rsync.core.components.backup_plan.application.commands import RemoveAllBackupBackupPlansCommand
from tui_rsync.core.components.backup_plan.application.commands import RemoveAllBackupPlansCommand
from tui_rsync.core.components.backup_plan.application.queries import GetAllBackupPlansQuery, GetBackupPlanCountQuery
from tui_rsync.core.components.backup_plan.application.repository import BackupPlanRepositoryPort, BackupPlanRepository
from tui_rsync.core.components.backup_plan.application.services import GetBackupPlanCountService, \
GetAllBackupPlansService
GetAllBackupPlansService, RemoveAllBackupPlansService
from tui_rsync.core.components.backup_plan.application.services.backup_plan_service import BackupPlanService
from tui_rsync.core.ports.configuration import UserDataPathsPort
from tui_rsync.core.ports.orm import DatabaseManagerPort
@@ -39,8 +39,13 @@ class TestingConfiguration(Module):
@provider
@singleton
def provide_remove_all_backup_plans_command(self, database_manager: DatabaseManagerPort) -> RemoveAllBackupBackupPlansCommand:
return RemoveAllBackupBackupPlansCommand(database_manager)
def provide_remove_all_backup_plans_command(self, database_manager: DatabaseManagerPort) -> RemoveAllBackupPlansCommand:
return RemoveAllBackupPlansCommand(database_manager)
@provider
@singleton
def provide_remove_all_backup_plans_service(self, command: RemoveAllBackupPlansCommand) -> RemoveAllBackupPlansService:
return RemoveAllBackupPlansService(command)
@provider
@singleton