浏览代码

fix: TenantAccountJoin has no attribute 'query' (#19445)

tags/1.4.0
非法操作 5 个月前
父节点
当前提交
220db55e71
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5
    2
      api/services/account_service.py

+ 5
- 2
api/services/account_service.py 查看文件

@@ -108,12 +108,15 @@ 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

正在加载...
取消
保存