diff --git a/python-backend/api/main.py b/python-backend/api/main.py index 2d2c7ab..8122d48 100644 --- a/python-backend/api/main.py +++ b/python-backend/api/main.py @@ -165,6 +165,24 @@ def health(): return {"status": "ok", "service": "signal-api", "version": "1.0.0"} +@app.get("/health/db") +def health_db(): + from core.supabase_client import get_client + import os + client = get_client() + if not client: + return { + "status": "unavailable", + "supabase_url_set": bool(os.getenv("SUPABASE_URL")), + "service_key_set": bool(os.getenv("SUPABASE_SERVICE_KEY")), + } + try: + result = client.table("organizations").select("id").limit(1).execute() + return {"status": "ok", "org_count": len(result.data)} + except Exception as e: + return {"status": "error", "detail": str(e)} + + @app.post("/api/upload", response_model=UploadResponse) async def upload_csv( file: UploadFile = File(...),