feat(api): assist type-autocomplete

This commit is contained in:
Taha Yassine Kraiem 2022-06-30 19:52:00 +02:00
parent 3738dea76d
commit 005faf75b1

View file

@ -135,13 +135,15 @@ def comment_assignment(projectId: int, sessionId: int, issueId: str, data: schem
def events_search(projectId: int, q: str,
type: Union[schemas.FilterType, schemas.EventType,
schemas.PerformanceEventType, schemas.FetchFilterType,
schemas.GraphqlFilterType] = None,
schemas.GraphqlFilterType, str] = None,
key: str = None, source: str = None, live: bool = False,
context: schemas.CurrentContext = Depends(OR_context)):
if len(q) == 0:
return {"data": []}
if live:
return assist.autocomplete(project_id=projectId, q=q, key=key)
return assist.autocomplete(project_id=projectId, q=q, key=type.value)
if isinstance(type, str):
return {"errors": ["Unsupported type"]}
if type in [schemas.FetchFilterType._url]:
type = schemas.EventType.request
elif type in [schemas.GraphqlFilterType._name]: