From 9ca2877fc21ed53f77dc13d22de2d0ec540b984b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Schl=C3=B6gl?= Date: Fri, 7 Jul 2023 14:08:38 +0200 Subject: [PATCH] fix: fixes an issue with vocabs in search not showing up --- intavia_backend/main_v2.py | 3 ++- intavia_backend/query_parameters_v2.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/intavia_backend/main_v2.py b/intavia_backend/main_v2.py index e724652..6fe7b16 100644 --- a/intavia_backend/main_v2.py +++ b/intavia_backend/main_v2.py @@ -30,6 +30,7 @@ RequestID, Search, Search_Base, + SearchEventKindVocab, SearchEvents, SearchOccupationsStats, SearchVocabs, @@ -438,7 +439,7 @@ async def bulk_retrieve_voc_event_roles( description="Endpoint that allows to query and retrieve event kinds.", ) @cache() -async def query_event_kind(search: SearchVocabs = Depends()): +async def query_event_kind(search: SearchEventKindVocab = Depends()): res = get_query_from_triplestore_v2(search, "event_kind_v2_1.sparql") res = flatten_rdf_data(res) pages = math.ceil(int(res[0]["count"]) / search.limit) if len(res) > 0 else 0 diff --git a/intavia_backend/query_parameters_v2.py b/intavia_backend/query_parameters_v2.py index 12cf624..d1215c3 100644 --- a/intavia_backend/query_parameters_v2.py +++ b/intavia_backend/query_parameters_v2.py @@ -254,6 +254,12 @@ class SearchOccupationsStats(Search_Base, QueryBase): class SearchEvents(SearchEventsBase, QueryBase): pass +@dataclasses.dataclass(kw_only=True) +class SearchEventKindVocab(QueryBase): + q: str = Query( + default=None, + description="Query for a label in the Vocabulary. Matching is done on substring level.", + ) @dataclasses.dataclass(kw_only=True) class SearchVocabs(QueryBase):