From c3f4721c2414c68d2d17734bdc2d16bbfdd54075 Mon Sep 17 00:00:00 2001 From: crazywoola <427733928@qq.com> Date: Sat, 10 May 2025 18:55:53 +0800 Subject: [PATCH] fix: tests --- api/services/account_service.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/services/account_service.py b/api/services/account_service.py index 113ae94e03..da03da69e9 100644 --- a/api/services/account_service.py +++ b/api/services/account_service.py @@ -822,6 +822,9 @@ class TenantService: db.session.query(TenantAccountJoin).filter_by(tenant_id=tenant.id, account_id=member.id).first() ) + if not target_member_join: + raise MemberNotInTenantError("Member not in tenant.") + if target_member_join.role == new_role: raise RoleAlreadyAssignedError("The provided role is already assigned to the member.") @@ -830,7 +833,8 @@ class TenantService: current_owner_join = ( db.session.query(TenantAccountJoin).filter_by(tenant_id=tenant.id, role="owner").first() ) - current_owner_join.role = "admin" + if current_owner_join: + current_owner_join.role = "admin" # Update the role of the target member target_member_join.role = new_role