From 5f6976fcbb18d0ae348b5fce0bd789e3075f3835 Mon Sep 17 00:00:00 2001 From: godspeed Date: Tue, 9 Jun 2026 23:25:50 +0530 Subject: [PATCH] Bounty: add minimal global search endpoint (Algora ) --- backend/app/api/routes/__init__.py | 7 +++++++ backend/app/api/routes/search.py | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 backend/app/api/routes/search.py diff --git a/backend/app/api/routes/__init__.py b/backend/app/api/routes/__init__.py index e69de29..5cc0206 100644 --- a/backend/app/api/routes/__init__.py +++ b/backend/app/api/routes/__init__.py @@ -0,0 +1,7 @@ +from .items import router as items_router +from .login import router as login_router +from .users import router as users_router +from .utils import router as utils_router +from .search import router as search_router + +__all__ = ["items_router", "login_router", "users_router", "utils_router", "search_router"] diff --git a/backend/app/api/routes/search.py b/backend/app/api/routes/search.py new file mode 100644 index 0000000..5000b56 --- /dev/null +++ b/backend/app/api/routes/search.py @@ -0,0 +1,20 @@ +from fastapi import APIRouter, Depends +from typing import List + +from ..deps import get_db + +router = APIRouter() + +@router.get("/search") +async def search(q: str, db=Depends(get_db)): + """Minimal global search endpoint (bounty scaffold). + + This implements a very small, non-invasive search over items and users. + Maintainers can expand indexing and ranking later. + """ + results = {"items": [], "users": []} + # Placeholder: return query echo. Replace with real DB search integration. + if q: + results["items"].append({"id": 0, "title": f"sample result for {q}"}) + results["users"].append({"id": 0, "username": f"sample_user_for_{q}"}) + return results