From 2dbbbb2e2acc57f27d7e304d908d8ee0bc778381 Mon Sep 17 00:00:00 2001 From: guerler Date: Sat, 9 Dec 2023 20:24:44 +0300 Subject: [PATCH] Add service layer for history query endpoint --- .../webapps/galaxy/services/histories.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/galaxy/webapps/galaxy/services/histories.py b/lib/galaxy/webapps/galaxy/services/histories.py index 6042bec0be2..a398146c318 100644 --- a/lib/galaxy/webapps/galaxy/services/histories.py +++ b/lib/galaxy/webapps/galaxy/services/histories.py @@ -51,6 +51,10 @@ from galaxy.schema import ( SerializationParams, ) from galaxy.schema.fields import DecodedDatabaseIdField +from galaxy.schema.history import ( + HistoryIndexQueryPayload, + HistorySummaryList, +) from galaxy.schema.schema import ( AnyArchivedHistoryView, AnyHistoryView, @@ -211,6 +215,23 @@ class HistoriesService(ServiceBase, ConsumesModelStores, ServesExportStores): # otherwise, do the default filter of removing the deleted histories return [model.History.deleted == false()] + def index_query( + self, + trans, + payload: HistoryIndexQueryPayload, + include_total_count: bool = False, + ) -> Tuple[HistorySummaryList, int]: + """Return a list of History accessible by the user + + :rtype: list + :returns: dictionaries containing History details + """ + entries, total_matches = self.manager.index_query(trans, payload, include_total_count) + return ( + HistorySummaryList(__root__=[entry.to_dict() for entry in entries]), + total_matches, + ) + def create( self, trans: ProvidesHistoryContext,