File size: 723 Bytes
819bacd
 
 
 
fe7c659
819bacd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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))