Add debug signup endpoint
Browse files- src/main.py +44 -0
src/main.py
CHANGED
|
@@ -112,6 +112,50 @@ async def health_check():
|
|
| 112 |
}
|
| 113 |
|
| 114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
# ============================================================================
|
| 116 |
# Exception Handlers
|
| 117 |
# ============================================================================
|
|
|
|
| 112 |
}
|
| 113 |
|
| 114 |
|
| 115 |
+
@app.get("/debug/test-signup", tags=["debug"])
|
| 116 |
+
async def debug_test_signup():
|
| 117 |
+
"""
|
| 118 |
+
Debug endpoint to test signup without frontend.
|
| 119 |
+
"""
|
| 120 |
+
try:
|
| 121 |
+
from src.services.auth_service import register_user
|
| 122 |
+
from src.models.database import get_db
|
| 123 |
+
import uuid
|
| 124 |
+
|
| 125 |
+
async def create_test_user():
|
| 126 |
+
db_gen = get_db()
|
| 127 |
+
db = await db_gen.__anext__()
|
| 128 |
+
|
| 129 |
+
try:
|
| 130 |
+
test_email = f"debug_{uuid.uuid4().hex[:8]}@test.com"
|
| 131 |
+
user = await register_user(
|
| 132 |
+
db,
|
| 133 |
+
email=test_email,
|
| 134 |
+
password="test123"
|
| 135 |
+
)
|
| 136 |
+
return {
|
| 137 |
+
"success": True,
|
| 138 |
+
"user_id": str(user.id),
|
| 139 |
+
"email": user.email
|
| 140 |
+
}
|
| 141 |
+
except Exception as e:
|
| 142 |
+
return {
|
| 143 |
+
"success": False,
|
| 144 |
+
"error": str(e),
|
| 145 |
+
"error_type": type(e).__name__
|
| 146 |
+
}
|
| 147 |
+
finally:
|
| 148 |
+
await db_gen.aclose()
|
| 149 |
+
|
| 150 |
+
return await create_test_user()
|
| 151 |
+
except Exception as e:
|
| 152 |
+
return {
|
| 153 |
+
"success": False,
|
| 154 |
+
"init_error": str(e),
|
| 155 |
+
"error_type": type(e).__name__
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
|
| 159 |
# ============================================================================
|
| 160 |
# Exception Handlers
|
| 161 |
# ============================================================================
|