mirror of
https://gitlab.com/KKlochko/tui-rsync.git
synced 2026-08-12 17:57:43 +00:00
Update the configuration to use queries and commands.
This commit is contained in:
+4
@@ -1,7 +1,11 @@
|
||||
from tui_rsync.core.ports.orm import DatabaseManagerPort
|
||||
from tui_rsync.infrastructure.orm.models import BackupPlanModel, DestinationModel
|
||||
|
||||
|
||||
class RemoveAllBackupBackupPlansCommand:
|
||||
def __init__(self, database_manager: DatabaseManagerPort):
|
||||
self.databaseManager = database_manager
|
||||
|
||||
def execute(self) -> bool:
|
||||
rows = BackupPlanModel.delete().execute()
|
||||
rows = DestinationModel.delete().execute() + rows
|
||||
|
||||
+4
@@ -1,8 +1,12 @@
|
||||
from tui_rsync.core.ports.orm import DatabaseManagerPort
|
||||
from tui_rsync.infrastructure.orm.dto.dtos import BackupPlanDTO
|
||||
|
||||
from tui_rsync.infrastructure.orm.models import BackupPlanModel
|
||||
|
||||
|
||||
class GetAllBackupBackupPlansQuery:
|
||||
def __init__(self, database_manager: DatabaseManagerPort):
|
||||
self.databaseManager = database_manager
|
||||
|
||||
def execute(self):
|
||||
return (BackupPlanDTO.to_domain(model) for model in BackupPlanModel.select().iterator())
|
||||
Reference in New Issue
Block a user