Fix user delete flow 4
This commit is contained in:
@@ -129,32 +129,6 @@ class TenantService:
|
||||
permissions=[]
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
async def get_user_tenants(user_id: str, db: AsyncSession) -> List[TenantResponse]:
|
||||
"""Get all tenants accessible by user"""
|
||||
|
||||
try:
|
||||
# Get user's tenant memberships
|
||||
result = await db.execute(
|
||||
select(Tenant)
|
||||
.join(TenantMember, Tenant.id == TenantMember.tenant_id)
|
||||
.where(
|
||||
and_(
|
||||
TenantMember.user_id == user_id,
|
||||
TenantMember.is_active == True,
|
||||
Tenant.is_active == True
|
||||
)
|
||||
)
|
||||
.order_by(Tenant.name)
|
||||
)
|
||||
|
||||
tenants = result.scalars().all()
|
||||
return [TenantResponse.from_orm(tenant) for tenant in tenants]
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting user tenants: {e}")
|
||||
return []
|
||||
|
||||
@staticmethod
|
||||
async def get_tenant_by_id(tenant_id: str, db: AsyncSession) -> Optional[TenantResponse]:
|
||||
"""Get tenant by ID"""
|
||||
|
||||
Reference in New Issue
Block a user