fix: AttributeError: 'Account' object has no attribute '_current_tenant'. Did you mean: 'current_tenant'?

This commit is contained in:
crazywoola 2025-05-20 11:05:31 +08:00
parent 6a8ca8296b
commit ee4b5bfca6
1 changed files with 2 additions and 1 deletions

View File

@ -62,7 +62,8 @@ class Account(UserMixin, Base):
@property
def current_tenant_id(self) -> str | None:
return self._current_tenant.id if self._current_tenant else None
ta = db.session.query(TenantAccountJoin).filter_by(account_id=self.id, current=True).first()
return ta.tenant_id if ta else None
def set_tenant_id(self, tenant_id: str):
tenant_account_join = cast(