Fix user delete flow 4

This commit is contained in:
Urtzi Alfaro
2025-08-02 18:38:14 +02:00
parent eedbc2401e
commit 8d1b7c1efb
4 changed files with 7 additions and 53 deletions

View File

@@ -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"""