from typing import Any from fastapi import HTTPException from fastapi.responses import JSONResponse from app.modules.querySearch.features.querySearch_feature import QuerySearchFeature class QuerySearchController: def __init__(self, query_search_feature: QuerySearchFeature): self.query_search_feature = query_search_feature async def handle_query_search(self, q: str) -> Any: try: result = await self.query_search_feature.query_search(q) message = result.get("message", "No message provided") return JSONResponse(status_code=200, content={"message": message}) except Exception as e: raise HTTPException(status_code=500, detail=str(e))