teljes backend_mentés

This commit is contained in:
Roo
2026-03-22 18:59:27 +00:00
parent 5d44339f21
commit 5d96b00f81
34 changed files with 2575 additions and 977 deletions

View File

@@ -2,33 +2,56 @@ from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.ext.asyncio import AsyncSession
from app.db.session import get_db
from app.services.asset_service import AssetService
from app.api import deps
from typing import List
router = APIRouter()
# Secured endpoint: Closed premium ecosystem
@router.get("/makes", response_model=List[str])
async def list_makes(db: AsyncSession = Depends(get_db)):
async def list_makes(
db: AsyncSession = Depends(get_db),
current_user = Depends(deps.get_current_user)
):
"""1. Szint: Márkák listázása."""
return await AssetService.get_makes(db)
# Secured endpoint: Closed premium ecosystem
@router.get("/models", response_model=List[str])
async def list_models(make: str, db: AsyncSession = Depends(get_db)):
async def list_models(
make: str,
db: AsyncSession = Depends(get_db),
current_user = Depends(deps.get_current_user)
):
"""2. Szint: Típusok listázása egy adott márkához."""
models = await AssetService.get_models(db, make)
if not models:
raise HTTPException(status_code=404, detail="Márka nem található vagy nincsenek típusok.")
return models
# Secured endpoint: Closed premium ecosystem
@router.get("/generations", response_model=List[str])
async def list_generations(make: str, model: str, db: AsyncSession = Depends(get_db)):
async def list_generations(
make: str,
model: str,
db: AsyncSession = Depends(get_db),
current_user = Depends(deps.get_current_user)
):
"""3. Szint: Generációk/Évjáratok listázása."""
generations = await AssetService.get_generations(db, make, model)
if not generations:
raise HTTPException(status_code=404, detail="Nincs generációs adat ehhez a típushoz.")
return generations
# Secured endpoint: Closed premium ecosystem
@router.get("/engines")
async def list_engines(make: str, model: str, gen: str, db: AsyncSession = Depends(get_db)):
async def list_engines(
make: str,
model: str,
gen: str,
db: AsyncSession = Depends(get_db),
current_user = Depends(deps.get_current_user)
):
"""4. Szint: Motorváltozatok és technikai specifikációk."""
engines = await AssetService.get_engines(db, make, model, gen)
if not engines: