Skip to content

Commit 1ec915d

Browse files
committed
webserver api
1 parent 2521650 commit 1ec915d

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

api/specs/web-server/_storage.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
# pylint: disable=too-many-arguments
55

66

7-
from typing import TypeAlias
7+
from typing import Annotated, TypeAlias
88
from uuid import UUID
99

10-
from fastapi import APIRouter, Query, status
10+
from fastapi import APIRouter, Depends, Query, status
11+
from fastapi_pagination.cursor import CursorPage
1112
from models_library.api_schemas_storage.storage_schemas import (
1213
FileLocation,
1314
FileMetaDataGet,
@@ -20,9 +21,11 @@
2021
)
2122
from models_library.api_schemas_webserver.storage import (
2223
DataExportPost,
24+
ListPathsQueryParams,
2325
StorageAsyncJobGet,
2426
StorageAsyncJobResult,
2527
StorageAsyncJobStatus,
28+
StorageLocationPathParams,
2629
)
2730
from models_library.generics import Envelope
2831
from models_library.projects_nodes_io import LocationID
@@ -53,12 +56,25 @@ async def list_storage_locations():
5356
"""Returns the list of available storage locations"""
5457

5558

59+
@router.get(
60+
"/storage/locations/{location_id}/paths",
61+
response_model=CursorPage[FileMetaDataGet],
62+
)
63+
async def list_storage_paths(
64+
_path: Annotated[StorageLocationPathParams, Depends()],
65+
_query: Annotated[ListPathsQueryParams, Depends()],
66+
):
67+
"""Lists the files/directories in WorkingDirectory"""
68+
69+
5670
@router.get(
5771
"/storage/locations/{location_id}/datasets",
5872
response_model=Envelope[list[DatasetMetaData]],
5973
description="Get datasets metadata",
6074
)
61-
async def list_datasets_metadata(location_id: LocationID):
75+
async def list_datasets_metadata(
76+
_path: Annotated[StorageLocationPathParams, Depends()],
77+
):
6278
"""returns all the top level datasets a user has access to"""
6379

6480

@@ -68,7 +84,7 @@ async def list_datasets_metadata(location_id: LocationID):
6884
description="Get datasets metadata",
6985
)
7086
async def get_files_metadata(
71-
location_id: LocationID,
87+
_path: Annotated[StorageLocationPathParams, Depends()],
7288
uuid_filter: str = "",
7389
expand_dirs: bool = Query(
7490
True,

api/specs/web-server/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
--constraint ../../../requirements/constraints.txt
44

55
fastapi
6+
fastapi-pagination
67
jsonref
78
pydantic
89
pydantic-extra-types

0 commit comments

Comments
 (0)