Replace Flask admin with FastAPI app (api/app/) featuring: - Dashboard with stat cards, sync control, and history - Mappings CRUD for ARTICOLE_TERTI with CSV import/export - Article autocomplete from NOM_ARTICOLE - SKU pre-validation before import - Sync orchestration: read JSONs -> validate -> import -> log to SQLite - APScheduler for periodic sync from UI - File logging to logs/sync_comenzi_YYYYMMDD_HHMMSS.log - Oracle pool None guard (503 vs 500 on unavailable) Test suite: - test_app_basic.py: 30 tests (imports + routes) without Oracle - test_integration.py: 9 integration tests with Oracle Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
11 lines
300 B
Python
11 lines
300 B
Python
from fastapi import APIRouter, Query
|
|
|
|
from ..services import article_service
|
|
|
|
router = APIRouter(prefix="/api/articles", tags=["articles"])
|
|
|
|
@router.get("/search")
|
|
def search_articles(q: str = Query("", min_length=2)):
|
|
results = article_service.search_articles(q)
|
|
return {"results": results}
|