From 65cac6affa209402b0d73cd9f6e5d16ac8b340b7 Mon Sep 17 00:00:00 2001 From: -LAN- Date: Wed, 9 Jul 2025 19:08:08 +0800 Subject: [PATCH] feat: Integrates execution repository inheritance Signed-off-by: -LAN- --- .../api_workflow_node_execution_repository.py | 11 ++--------- api/repositories/api_workflow_run_repository.py | 3 ++- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/api/repositories/api_workflow_node_execution_repository.py b/api/repositories/api_workflow_node_execution_repository.py index 9e36e0ef7e..94b4012da9 100644 --- a/api/repositories/api_workflow_node_execution_repository.py +++ b/api/repositories/api_workflow_node_execution_repository.py @@ -9,15 +9,15 @@ The service repository handles operations that require access to database-specif tenant_id, app_id, triggered_from, etc., which are not part of the core domain model. """ -from abc import abstractmethod from collections.abc import Sequence from datetime import datetime from typing import Optional, Protocol +from core.workflow.repositories.workflow_node_execution_repository import WorkflowNodeExecutionRepository from models.workflow import WorkflowNodeExecutionModel -class DifyAPIWorkflowNodeExecutionRepository(Protocol): +class DifyAPIWorkflowNodeExecutionRepository(WorkflowNodeExecutionRepository, Protocol): """ Protocol for service-layer operations on WorkflowNodeExecutionModel. @@ -38,7 +38,6 @@ class DifyAPIWorkflowNodeExecutionRepository(Protocol): - Supports cleanup and maintenance operations """ - @abstractmethod def get_node_last_execution( self, tenant_id: str, @@ -63,7 +62,6 @@ class DifyAPIWorkflowNodeExecutionRepository(Protocol): """ ... - @abstractmethod def get_executions_by_workflow_run( self, tenant_id: str, @@ -86,7 +84,6 @@ class DifyAPIWorkflowNodeExecutionRepository(Protocol): """ ... - @abstractmethod def get_execution_by_id( self, execution_id: str, @@ -107,7 +104,6 @@ class DifyAPIWorkflowNodeExecutionRepository(Protocol): """ ... - @abstractmethod def delete_expired_executions( self, tenant_id: str, @@ -130,7 +126,6 @@ class DifyAPIWorkflowNodeExecutionRepository(Protocol): """ ... - @abstractmethod def delete_executions_by_app( self, tenant_id: str, @@ -153,7 +148,6 @@ class DifyAPIWorkflowNodeExecutionRepository(Protocol): """ ... - @abstractmethod def get_expired_executions_batch( self, tenant_id: str, @@ -176,7 +170,6 @@ class DifyAPIWorkflowNodeExecutionRepository(Protocol): """ ... - @abstractmethod def delete_executions_by_ids( self, execution_ids: Sequence[str], diff --git a/api/repositories/api_workflow_run_repository.py b/api/repositories/api_workflow_run_repository.py index c91e6e0904..59e7baeb79 100644 --- a/api/repositories/api_workflow_run_repository.py +++ b/api/repositories/api_workflow_run_repository.py @@ -38,11 +38,12 @@ from collections.abc import Sequence from datetime import datetime from typing import Optional, Protocol +from core.workflow.repositories.workflow_execution_repository import WorkflowExecutionRepository from libs.infinite_scroll_pagination import InfiniteScrollPagination from models.workflow import WorkflowRun -class APIWorkflowRunRepository(Protocol): +class APIWorkflowRunRepository(WorkflowExecutionRepository, Protocol): """ Protocol for service-layer WorkflowRun repository operations.