From fa407cdc90254e0e05880256d0dd73fd8525d1c6 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Mon, 14 Apr 2025 18:11:04 -0400 Subject: [PATCH] Bump pagination limit to 10000 --- .trunk/trunk.yaml | 18 +++++++++--------- backend/endpoints/rom.py | 11 +++++++++-- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index cf26fada9..8e59d5e81 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -2,12 +2,12 @@ # To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml version: 0.1 cli: - version: 1.22.11 + version: 1.22.12 # Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins) plugins: sources: - id: trunk - ref: v1.6.7 + ref: v1.6.8 uri: https://github.com/trunk-io/plugins # Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes) runtimes: @@ -19,25 +19,25 @@ runtimes: lint: enabled: - markdownlint@0.44.0 - - eslint@9.22.0 + - eslint@9.24.0 - actionlint@1.7.7 - bandit@1.8.3 - black@25.1.0 - - checkov@3.2.386 + - checkov@3.2.404 - git-diff-check - isort@6.0.1 - mypy@1.15.0 - - osv-scanner@2.0.0 + - osv-scanner@2.0.1 - oxipng@9.1.4 - prettier@3.5.3 - - ruff@0.11.0 + - ruff@0.11.5 - shellcheck@0.10.0 - shfmt@3.6.0 - svgo@3.3.2 - taplo@0.9.3 - - trivy@0.60.0 - - trufflehog@3.88.17 - - yamllint@1.36.2 + - trivy@0.61.0 + - trufflehog@3.88.23 + - yamllint@1.37.0 ignore: - linters: [ALL] paths: diff --git a/backend/endpoints/rom.py b/backend/endpoints/rom.py index fed8b75ae..0892b5097 100644 --- a/backend/endpoints/rom.py +++ b/backend/endpoints/rom.py @@ -27,10 +27,10 @@ from endpoints.responses.rom import ( ) from exceptions.endpoint_exceptions import RomNotFoundInDatabaseException from exceptions.fs_exceptions import RomAlreadyExistsException -from fastapi import HTTPException, Request, UploadFile, status +from fastapi import HTTPException, Query, Request, UploadFile, status from fastapi.responses import Response from fastapi_pagination.ext.sqlalchemy import paginate -from fastapi_pagination.limit_offset import LimitOffsetPage +from fastapi_pagination.limit_offset import LimitOffsetPage, LimitOffsetParams from handler.auth.constants import Scope from handler.database import db_platform_handler, db_rom_handler from handler.database.base_handler import sync_session @@ -120,8 +120,15 @@ async def add_rom(request: Request): return Response(status_code=status.HTTP_201_CREATED) +class CustomLimitOffsetParams(LimitOffsetParams): + # Temporarily increase the limit until we can implement pagination on all apps + limit: int = Query(50, ge=1, le=10_000, description="Page size limit") + offset: int = Query(0, ge=0, description="Page offset") + + class CustomLimitOffsetPage(LimitOffsetPage[T]): char_index: dict[str, int] + __params_type__ = CustomLimitOffsetParams @protected_route(router.get, "", [Scope.ROMS_READ])