Update the configuration to use queries and commands.

This commit is contained in:
2025-01-11 17:52:06 +02:00
parent a0846b93a1
commit 70f60ff715
8 changed files with 32 additions and 19 deletions
@@ -1,3 +1,5 @@
from .user_data_paths import UserDataPaths
from .current_configuration import CurrentConfiguration
from .configuration import Configuration
__all__ = ['UserDataPaths']
__all__ = ['UserDataPaths', 'CurrentConfiguration', 'Configuration']
@@ -1,5 +1,7 @@
from injector import singleton, inject, Injector, Module, provider
from tui_rsync.core.components.backup_plan.application.commands import RemoveAllBackupBackupPlansCommand
from tui_rsync.core.components.backup_plan.application.queries import GetAllBackupBackupPlansQuery
from tui_rsync.core.components.backup_plan.application.repository import BackupPlanRepositoryPort
from tui_rsync.core.components.backup_plan.application.repository.backup_plan_repository import BackupPlanRepository
from tui_rsync.core.components.backup_plan.application.services.backup_plan_service import BackupPlanService
@@ -29,3 +31,13 @@ class Configuration(Module):
@singleton
def provide_backup_plan_service(self, backup_plan_repository: BackupPlanRepositoryPort) -> BackupPlanService:
return BackupPlanService(backup_plan_repository)
@provider
@singleton
def provide_remove_all_backup_backup_plans_command(self, database_manager: DatabaseManagerPort) -> RemoveAllBackupBackupPlansCommand:
return RemoveAllBackupBackupPlansCommand(database_manager)
@provider
@singleton
def provide_get_all_backup_backup_plans_query(self, database_manager: DatabaseManagerPort) -> GetAllBackupBackupPlansQuery:
return GetAllBackupBackupPlansQuery(database_manager)