mirror of
https://gitlab.com/KKlochko/tui-rsync.git
synced 2026-08-12 17:57:43 +00:00
Add the injector and configurations.
This commit is contained in:
@@ -21,12 +21,10 @@ from rich.console import Console
|
||||
from typing import List, Optional
|
||||
import typer
|
||||
|
||||
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.components.backup_plan.domain import BackupPlan, Source, Destination
|
||||
from tui_rsync.core.shared_kernel.components.common import Label
|
||||
from tui_rsync.infrastructure.configuration import UserDataPaths
|
||||
from tui_rsync.infrastructure.orm import SqliteDatabaseManager
|
||||
from tui_rsync.infrastructure.configuration.current_configuration import CurrentConfiguration
|
||||
|
||||
|
||||
console = Console()
|
||||
@@ -58,9 +56,7 @@ def add(
|
||||
if source is None:
|
||||
source = console.input("What is the [yellow b]path to the source[/]? ")
|
||||
|
||||
db = SqliteDatabaseManager(UserDataPaths())
|
||||
repository = BackupPlanRepository(db)
|
||||
service = BackupPlanService(repository)
|
||||
service: BackupPlanService = CurrentConfiguration.get(BackupPlanService)
|
||||
|
||||
plan = BackupPlan(label=Label(label), source=Source(source), destinations=[Destination(path) for path in destinations])
|
||||
service.add(plan)
|
||||
|
||||
Reference in New Issue
Block a user