fix: add fast path

This commit is contained in:
hj24 2025-10-13 16:23:13 +08:00
parent 064075ab5f
commit ed97dce06e
1 changed files with 11 additions and 5 deletions

View File

@ -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,
),
)