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, query: str) -> JSONResponse: try: result = await self.query_search_feature.query_search(query) return JSONResponse(status_code=200, content=result.model_dump()) except Exception as e: raise HTTPException(status_code=500, detail=str(e))