Skip to content

Commit d7f1d81

Browse files
committed
better naming
1 parent 34f462a commit d7f1d81

File tree

3 files changed

+12
-11
lines changed
  • api/specs/web-server
  • packages/models-library/src/models_library/api_schemas_webserver
  • services/storage/src/simcore_service_storage/api/rest

3 files changed

+12
-11
lines changed

api/specs/web-server/_storage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
PresignedLink,
2121
)
2222
from models_library.api_schemas_webserver.storage import (
23+
CustomizedPathsCursorPage,
2324
DataExportPost,
24-
LargeLimitedPage,
2525
ListPathsQueryParams,
2626
StorageAsyncJobGet,
2727
StorageAsyncJobResult,
@@ -59,7 +59,7 @@ async def list_storage_locations():
5959

6060
@router.get(
6161
"/storage/locations/{location_id}/paths",
62-
response_model=LargeLimitedPage[PathMetaDataGet],
62+
response_model=CustomizedPathsCursorPage[PathMetaDataGet],
6363
)
6464
async def list_storage_paths(
6565
_path: Annotated[StorageLocationPathParams, Depends()],

packages/models-library/src/models_library/api_schemas_webserver/storage.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from datetime import datetime
22
from pathlib import Path
3-
from typing import Annotated, Any, TypeVar
3+
from typing import Annotated, Any, Final, TypeVar
44

55
from fastapi import Query
66
from fastapi_pagination.cursor import CursorPage
@@ -22,15 +22,16 @@
2222
from ._base import InputSchema, OutputSchema
2323

2424
_T = TypeVar("_T")
25-
26-
LargeLimitedPage = CustomizedPage[
25+
DEFAULT_NUMBER_OF_PATHS_PER_PAGE: Final[int] = 50
26+
MAX_NUMBER_OF_PATHS_PER_PAGE: Final[int] = 1000
27+
CustomizedPathsCursorPage = CustomizedPage[
2728
CursorPage[_T],
2829
# Customizes the maximum value to fit frontend needs
2930
UseParamsFields(
3031
size=Query(
31-
50,
32+
DEFAULT_NUMBER_OF_PATHS_PER_PAGE,
3233
ge=1,
33-
le=1000,
34+
le=MAX_NUMBER_OF_PATHS_PER_PAGE,
3435
description="Page size",
3536
)
3637
),

services/storage/src/simcore_service_storage/api/rest/_paths.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from fastapi import APIRouter, Depends
66
from fastapi_pagination import create_page, resolve_params
77
from models_library.api_schemas_storage.storage_schemas import PathMetaDataGet
8-
from models_library.api_schemas_webserver.storage import LargeLimitedPage
8+
from models_library.api_schemas_webserver.storage import CustomizedPathsCursorPage
99
from models_library.users import UserID
1010

1111
from ...dsm_factory import BaseDataManager
@@ -22,14 +22,14 @@
2222

2323
@router.get(
2424
"/locations/{location_id}/paths",
25-
response_model=LargeLimitedPage[PathMetaDataGet],
25+
response_model=CustomizedPathsCursorPage[PathMetaDataGet],
2626
)
2727
async def list_paths(
28-
page_params: Annotated[LargeLimitedPage.__params_type__, Depends()],
28+
page_params: Annotated[CustomizedPathsCursorPage.__params_type__, Depends()],
2929
dsm: Annotated[BaseDataManager, Depends(get_data_manager)],
3030
user_id: UserID,
3131
file_filter: Path | None = None,
32-
) -> LargeLimitedPage[PathMetaDataGet]:
32+
) -> CustomizedPathsCursorPage[PathMetaDataGet]:
3333
"""Returns one level of files (paginated)"""
3434
page_params = resolve_params()
3535
items, next_cursor, total_number = await dsm.list_paths(

0 commit comments

Comments
 (0)