From ed97dce06e944dd4e5b6c537b51e0e2940b0084f Mon Sep 17 00:00:00 2001 From: hj24 Date: Mon, 13 Oct 2025 16:23:13 +0800 Subject: [PATCH] fix: add fast path --- api/services/workflow_app_service.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/api/services/workflow_app_service.py b/api/services/workflow_app_service.py index 7d313bbc30..24bff5881d 100644 --- a/api/services/workflow_app_service.py +++ b/api/services/workflow_app_service.py @@ -86,16 +86,22 @@ class WorkflowAppService: ), ) if created_by_account: - account = session.scalar( - select(Account).where(Account.email == created_by_account) - ) - account_id = account.id if account else None + account = session.scalar(select(Account).where(Account.email == created_by_account)) + if not account: + return { + "page": page, + "limit": limit, + "total": 0, + "has_more": False, + "data": [], + } + stmt = stmt.join( Account, and_( WorkflowAppLog.created_by == Account.id, WorkflowAppLog.created_by_role == CreatorUserRole.ACCOUNT, - Account.id == account_id, + Account.id == account.id, ), )