Fix setup router: use explicit full paths instead of empty prefix route
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@ from ..dependencies import get_db
|
|||||||
from ..models.user import User
|
from ..models.user import User
|
||||||
from ..services.auth import hash_password, create_token
|
from ..services.auth import hash_password, create_token
|
||||||
|
|
||||||
router = APIRouter(prefix="/api/setup", tags=["setup"])
|
router = APIRouter(tags=["setup"])
|
||||||
|
|
||||||
|
|
||||||
class SetupRequest(BaseModel):
|
class SetupRequest(BaseModel):
|
||||||
@@ -16,14 +16,14 @@ class SetupRequest(BaseModel):
|
|||||||
email: str = ""
|
email: str = ""
|
||||||
|
|
||||||
|
|
||||||
@router.get("/status")
|
@router.get("/api/setup/status")
|
||||||
async def setup_status(db: AsyncSession = Depends(get_db)):
|
async def setup_status(db: AsyncSession = Depends(get_db)):
|
||||||
result = await db.execute(select(func.count()).select_from(User))
|
result = await db.execute(select(func.count()).select_from(User))
|
||||||
count = result.scalar()
|
count = result.scalar()
|
||||||
return {"needsSetup": count == 0}
|
return {"needsSetup": count == 0}
|
||||||
|
|
||||||
|
|
||||||
@router.post("")
|
@router.post("/api/setup")
|
||||||
async def run_setup(body: SetupRequest, db: AsyncSession = Depends(get_db)):
|
async def run_setup(body: SetupRequest, db: AsyncSession = Depends(get_db)):
|
||||||
result = await db.execute(select(func.count()).select_from(User))
|
result = await db.execute(select(func.count()).select_from(User))
|
||||||
if result.scalar() > 0:
|
if result.scalar() > 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user