Add service layer for history query endpoint

This commit is contained in:
guerler
2024-01-11 20:35:29 +03:00
parent 69b616a747
commit 2dbbbb2e2a
@@ -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,