mirror of
https://gitlab.com/KKlochko/tui-rsync.git
synced 2026-09-17 10:57:43 +00:00
32 lines
1.3 KiB
Python
32 lines
1.3 KiB
Python
from injector import singleton, inject, Injector, Module, provider
|
|
|
|
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
|
|
from tui_rsync.core.ports.configuration import UserDataPathsPort
|
|
from tui_rsync.core.ports.orm import DatabaseManagerPort
|
|
from tui_rsync.infrastructure.configuration import UserDataPaths
|
|
from tui_rsync.infrastructure.orm import SqliteDatabaseManager
|
|
|
|
|
|
class Configuration(Module):
|
|
@provider
|
|
@singleton
|
|
def provide_user_data_paths(self) -> UserDataPathsPort:
|
|
return UserDataPaths()
|
|
|
|
@provider
|
|
@singleton
|
|
def provide_database_manager(self, user_data_paths: UserDataPathsPort) -> DatabaseManagerPort:
|
|
return SqliteDatabaseManager(user_data_paths)
|
|
|
|
@provider
|
|
@singleton
|
|
def provide_backup_plan_repository(self, database_manager: DatabaseManagerPort) -> BackupPlanRepositoryPort:
|
|
return BackupPlanRepository(database_manager)
|
|
|
|
@provider
|
|
@singleton
|
|
def provide_backup_plan_service(self, backup_plan_repository: BackupPlanRepositoryPort) -> BackupPlanService:
|
|
return BackupPlanService(backup_plan_repository)
|