From c6c52cfe1100ef401d4941f71f7b28601473f579 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Sun, 27 Dec 2020 17:33:01 +0200 Subject: [PATCH] Implement collection list. --- etebase_fastapi/collection.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/etebase_fastapi/collection.py b/etebase_fastapi/collection.py index 0f019fa..56e2180 100644 --- a/etebase_fastapi/collection.py +++ b/etebase_fastapi/collection.py @@ -166,7 +166,9 @@ def collection_list_common( limit: int, prefetch: Prefetch, ) -> MsgpackResponse: - result, new_stoken_obj, done = filter_by_stoken_and_limit(stoken, limit, queryset, models.Collection.stoken_annotation) + result, new_stoken_obj, done = filter_by_stoken_and_limit( + stoken, limit, queryset, models.Collection.stoken_annotation + ) new_stoken = new_stoken_obj and new_stoken_obj.uid context = Context(user, prefetch) data: t.List[CollectionOut] = [CollectionOut.from_orm_context(item, context) for item in result] @@ -227,9 +229,13 @@ async def list_multi( @collection_router.post("/list/") async def collection_list( req: Request, + stoken: t.Optional[str] = None, + limit: int = 50, + prefetch: Prefetch = PrefetchQuery, user: User = Depends(get_authenticated_user), ): - pass + queryset = get_collection_queryset(user, default_queryset) + return await collection_list_common(queryset, user, stoken, limit, prefetch) def process_revisions_for_item(item: models.CollectionItem, revision_data: CollectionItemRevisionInOut):