From bd31158e29a8e4dae130ce62dc0949cb2bcf358d Mon Sep 17 00:00:00 2001 From: hjlarry Date: Fri, 9 May 2025 15:48:31 +0800 Subject: [PATCH] fix TenantAccountJoin has no attribute 'query' --- api/services/account_service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/services/account_service.py b/api/services/account_service.py index 2d391ea7c2..c819daa29c 100644 --- a/api/services/account_service.py +++ b/api/services/account_service.py @@ -108,12 +108,12 @@ class AccountService: if account.status == AccountStatus.BANNED.value: raise Unauthorized("Account is banned.") - current_tenant = TenantAccountJoin.query.filter_by(account_id=account.id, current=True).first() + current_tenant = db.session.query(TenantAccountJoin).filter_by(account_id=account.id, current=True).first() if current_tenant: account.set_tenant_id(current_tenant.tenant_id) else: available_ta = ( - TenantAccountJoin.query.filter_by(account_id=account.id).order_by(TenantAccountJoin.id.asc()).first() + db.session.query(TenantAccountJoin).filter_by(account_id=account.id).order_by(TenantAccountJoin.id.asc()).first() ) if not available_ta: return None