fix: update current tenant id of account when switching tenant (#2530)

This commit is contained in:
Bowen Liang 2024-02-23 10:51:19 +08:00 committed by GitHub
parent 6c4e6bf1d6
commit 9ecc736c30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -282,9 +282,9 @@ class TenantService:
else:
TenantAccountJoin.query.filter(TenantAccountJoin.account_id == account.id, TenantAccountJoin.tenant_id != tenant_id).update({'current': False})
tenant_account_join.current = True
db.session.commit()
# Set the current tenant for the account
account.current_tenant_id = tenant_account_join.tenant_id
db.session.commit()
@staticmethod
def get_tenant_members(tenant: Tenant) -> list[Account]: