From b9564d75e71cf860f6316a8fdff5c68e63e3cf37 Mon Sep 17 00:00:00 2001 From: KKlochko Date: Wed, 8 Jan 2025 15:36:38 +0200 Subject: [PATCH] Add the query to get all backup plans. --- .../backup_plan/application/Queries/__init__.py | 3 +++ .../application/Queries/get_all_backup_plans_query.py | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 tui_rsync/core/components/backup_plan/application/Queries/__init__.py create mode 100644 tui_rsync/core/components/backup_plan/application/Queries/get_all_backup_plans_query.py diff --git a/tui_rsync/core/components/backup_plan/application/Queries/__init__.py b/tui_rsync/core/components/backup_plan/application/Queries/__init__.py new file mode 100644 index 0000000..aa5c7b0 --- /dev/null +++ b/tui_rsync/core/components/backup_plan/application/Queries/__init__.py @@ -0,0 +1,3 @@ +from .get_all_backup_plans_query import GetAllBackupBackupPlansQuery + +__all__ = ['GetAllBackupBackupPlansQuery'] diff --git a/tui_rsync/core/components/backup_plan/application/Queries/get_all_backup_plans_query.py b/tui_rsync/core/components/backup_plan/application/Queries/get_all_backup_plans_query.py new file mode 100644 index 0000000..418ca40 --- /dev/null +++ b/tui_rsync/core/components/backup_plan/application/Queries/get_all_backup_plans_query.py @@ -0,0 +1,8 @@ +from tui_rsync.infrastructure.orm.dto.dtos import BackupPlanDTO + +from tui_rsync.infrastructure.orm.models import BackupPlanModel + + +class GetAllBackupBackupPlansQuery: + def execute(self): + return (BackupPlanDTO.to_domain(model) for model in BackupPlanModel.select().iterator())