TorbatYar/backend/services/workspace/app/api/deps.py
Mortezakoohjani a483b47369 feat(workspace): complete production workspace and content operations
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 11:54:17 +03:30

14 lines
381 B
Python

from uuid import UUID
from fastapi import Request
from shared.exceptions import TenantNotResolvedError
from shared.tenant import STATE_TENANT_ID
def require_tenant(request: Request):
tenant_id = getattr(request.state, STATE_TENANT_ID, None)
if tenant_id is None:
raise TenantNotResolvedError("X-Tenant-ID required")
return UUID(str(tenant_id))