mirror of https://gitlab.com/KKlochko/tui-rsync
				
				
				
			
							parent
							
								
									d652469748
								
							
						
					
					
						commit
						476a0ef8cf
					
				| @ -1,3 +1,4 @@ | ||||
| from .get_all_backup_plans_query import GetAllBackupBackupPlansQuery | ||||
| from .get_backup_plan_by_id_query import GetBackupBackupPlanByIdQuery | ||||
| 
 | ||||
| __all__ = ['GetAllBackupBackupPlansQuery'] | ||||
| __all__ = ['GetAllBackupBackupPlansQuery', 'GetBackupBackupPlanByIdQuery'] | ||||
|  | ||||
| @ -0,0 +1,20 @@ | ||||
| from tui_rsync.core.components.backup_plan.domain import BackupPlan | ||||
| from tui_rsync.core.ports.orm import DatabaseManagerPort | ||||
| from tui_rsync.core.shared_kernel.components.common import UUID | ||||
| from tui_rsync.core.shared_kernel.ports.Exceptions.query_exception import QueryException | ||||
| from tui_rsync.infrastructure.orm.dto.dtos import BackupPlanDTO | ||||
| 
 | ||||
| from tui_rsync.infrastructure.orm.models import BackupPlanModel | ||||
| 
 | ||||
| 
 | ||||
| class GetBackupBackupPlanByIdQuery: | ||||
|     def __init__(self, database_manager: DatabaseManagerPort): | ||||
|         self.databaseManager = database_manager | ||||
| 
 | ||||
|     def execute(self, uuid: UUID) -> BackupPlan: | ||||
|         model = BackupPlanModel.get_or_none(BackupPlanModel.id == uuid.id) | ||||
| 
 | ||||
|         if model is None: | ||||
|             raise QueryException("The backup plan was not found.") | ||||
| 
 | ||||
|         return BackupPlanDTO.to_domain(model) | ||||
| @ -0,0 +1,6 @@ | ||||
| from . import AppException | ||||
| 
 | ||||
| 
 | ||||
| class QueryException(AppException): | ||||
|     """Query failed.""" | ||||
|     pass | ||||
					Loading…
					
					
				
		Reference in new issue