Add the configuration to get user data.

This commit is contained in:
2025-01-10 21:58:35 +02:00
parent ea0cc3dab0
commit f3915d93a9
9 changed files with 90 additions and 6 deletions
@@ -25,6 +25,7 @@ from tui_rsync.core.components.backup_plan.application.repository.backup_plan_re
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
@@ -57,7 +58,7 @@ def add(
if source is None:
source = console.input("What is the [yellow b]path to the source[/]? ")
db = SqliteDatabaseManager()
db = SqliteDatabaseManager(UserDataPaths())
repository = BackupPlanRepository(db)
service = BackupPlanService(repository)
@@ -24,6 +24,7 @@ from tui_rsync.core.components.backup_plan.application.commands import RemoveAll
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.shared_kernel.components.common import UUID
from tui_rsync.infrastructure.configuration import UserDataPaths
from tui_rsync.infrastructure.orm import SqliteDatabaseManager
console = Console()
@@ -42,7 +43,7 @@ def one(
[red b]Remove[/] an [yellow]existing backup plan[/].
"""
db = SqliteDatabaseManager()
db = SqliteDatabaseManager(UserDataPaths())
repository = BackupPlanRepository(db)
service = BackupPlanService(repository)
@@ -65,7 +66,7 @@ def all():
[red b]Remove[/] [yellow] all existing backup plans[/].
"""
db = SqliteDatabaseManager()
db = SqliteDatabaseManager(UserDataPaths())
removed = RemoveAllBackupBackupPlansCommand().execute()
if removed:
@@ -25,6 +25,7 @@ from tui_rsync.core.components.backup_plan.application.Queries import GetAllBack
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.shared_kernel.components.common import UUID
from tui_rsync.infrastructure.configuration import UserDataPaths
from tui_rsync.infrastructure.orm import SqliteDatabaseManager
from tui_rsync.user_interface.cli.components.backup_plan.formating import BackupPlanFormat
@@ -44,7 +45,7 @@ def one(
[green b]Show[/] an [yellow]existing backup plan by the id[/].
"""
db = SqliteDatabaseManager()
db = SqliteDatabaseManager(UserDataPaths())
repository = BackupPlanRepository(db)
service = BackupPlanService(repository)
@@ -67,7 +68,7 @@ def all():
[green b]Show[/] [yellow]all existing backup plans[/].
"""
db = SqliteDatabaseManager()
db = SqliteDatabaseManager(UserDataPaths())
query = GetAllBackupBackupPlansQuery()
for backup_plan in query.execute():