From 005faf75b17893168de5c3645aa3c4296c120209 Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Thu, 30 Jun 2022 19:52:00 +0200 Subject: [PATCH] feat(api): assist type-autocomplete --- api/routers/core.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/routers/core.py b/api/routers/core.py index 34d221f4e..81b1dabdb 100644 --- a/api/routers/core.py +++ b/api/routers/core.py @@ -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]: