feat: multi-robot architecture, car-robot rename, and credit-based OCR logic spec
This commit is contained in:
Binary file not shown.
@@ -1,5 +1,10 @@
|
||||
from fastapi import APIRouter
|
||||
from app.api.v1.endpoints import auth
|
||||
from app.api.v1.endpoints import auth, catalog # <--- Hozzáadtuk a catalog-ot
|
||||
|
||||
api_router = APIRouter()
|
||||
api_router.include_router(auth.router, prefix="/auth", tags=["Authentication"])
|
||||
|
||||
# Autentikáció és KYC végpontok
|
||||
api_router.include_router(auth.router, prefix="/auth", tags=["Authentication"])
|
||||
|
||||
# Jármű Katalógus és Robot kereső végpontok
|
||||
api_router.include_router(catalog.router, prefix="/catalog", tags=["Vehicle Catalog"])
|
||||
BIN
backend/app/api/v1/endpoints/__pycache__/catalog.cpython-312.pyc
Normal file
BIN
backend/app/api/v1/endpoints/__pycache__/catalog.cpython-312.pyc
Normal file
Binary file not shown.
37
backend/app/api/v1/endpoints/catalog.py
Normal file
37
backend/app/api/v1/endpoints/catalog.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from fastapi import APIRouter, Depends, Query
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy import select, or_
|
||||
from app.db.session import get_db
|
||||
from app.models.vehicle import VehicleCatalog
|
||||
from typing import List
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/search")
|
||||
async def search_catalog(
|
||||
q: str = Query(..., min_length=2, description="Márka vagy típus keresése"),
|
||||
category: str = None,
|
||||
db: AsyncSession = Depends(get_db)
|
||||
):
|
||||
"""Keresés a Robot által feltöltött katalógusban."""
|
||||
stmt = select(VehicleCatalog).where(
|
||||
or_(
|
||||
VehicleCatalog.brand.ilike(f"%{q}%"),
|
||||
VehicleCatalog.model.ilike(f"%{q}%")
|
||||
)
|
||||
)
|
||||
if category:
|
||||
stmt = stmt.where(VehicleCatalog.category == category)
|
||||
|
||||
result = await db.execute(stmt.limit(20))
|
||||
items = result.scalars().all()
|
||||
|
||||
return [
|
||||
{
|
||||
"id": i.id,
|
||||
"full_name": f"{i.brand} {i.model}",
|
||||
"category": i.category,
|
||||
"status": i.verification_status,
|
||||
"specs": i.factory_specs
|
||||
} for i in items
|
||||
]
|
||||
Reference in New Issue
Block a user