You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.3 KiB

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)