1818from models_library .folders import FolderID
1919from models_library .generics import Envelope
2020from models_library .rest_pagination import PageQueryParameters
21+ from models_library .utils .json_serialization import json_dumps
2122from models_library .workspaces import WorkspaceID
2223from pydantic import Json
2324from simcore_service_webserver ._meta import API_VTAG
2728 FoldersPathParams ,
2829)
2930
31+
32+ class _ListQuery (PageQueryParameters ):
33+ workspace_id : WorkspaceID | None = None
34+ folder_id : FolderID | None = None
35+
36+ order_by : Annotated [
37+ Json ,
38+ Query (
39+ description = FolderListWithJsonStrQueryParams .__fields__ [
40+ "order_by"
41+ ].field_info .description ,
42+ ),
43+ ] = json_dumps (
44+ FolderListWithJsonStrQueryParams .__fields__ ["order_by" ].field_info .default
45+ )
46+ filters : Annotated [
47+ Json | None ,
48+ Query (description = FolderFilters .schema_json (indent = 1 )),
49+ ] = None
50+
51+
3052router = APIRouter (
3153 prefix = f"/{ API_VTAG } " ,
3254 tags = [
@@ -49,24 +71,7 @@ async def create_folder(_b: CreateFolderBodyParams):
4971 response_model = Envelope [list [FolderGet ]],
5072)
5173async def list_folders (
52- _q : Annotated [PageQueryParameters , Depends ()],
53- folder_id : FolderID | None = None ,
54- workspace_id : WorkspaceID | None = None ,
55- order_by : Annotated [
56- Json ,
57- Query (
58- description = FolderListWithJsonStrQueryParams .__fields__ [
59- "order_by"
60- ].field_info .description ,
61- example = FolderListWithJsonStrQueryParams .__fields__ [
62- "order_by"
63- ].field_info .extra .get ("example" ),
64- ),
65- ] = FolderListWithJsonStrQueryParams .__fields__ ["order_by" ].field_info .default ,
66- filters : Annotated [
67- Json | None ,
68- Query (description = FolderFilters .schema_json (indent = 1 )),
69- ] = None ,
74+ _q : Annotated [_ListQuery , Depends ()],
7075):
7176 ...
7277
0 commit comments