From e428fea3da68d9e27a9205873108d8762dcbe785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Tue, 24 Oct 2023 19:39:43 +0200 Subject: [PATCH] refac: decorator calls --- api/ovdashboard_api/routers/v1/file.py | 4 +--- api/ovdashboard_api/routers/v1/image.py | 9 ++------- api/ovdashboard_api/routers/v1/misc.py | 10 ++-------- api/ovdashboard_api/routers/v1/text.py | 4 ---- api/ovdashboard_api/routers/v1/ticker.py | 5 +---- 5 files changed, 6 insertions(+), 26 deletions(-) diff --git a/api/ovdashboard_api/routers/v1/file.py b/api/ovdashboard_api/routers/v1/file.py index 6d83091..93d0bbb 100644 --- a/api/ovdashboard_api/routers/v1/file.py +++ b/api/ovdashboard_api/routers/v1/file.py @@ -52,7 +52,6 @@ async def start_router() -> None: @router.get( "/list", - response_model=list[str], responses=_ls.responses, ) async def list_all_files( @@ -63,7 +62,6 @@ async def list_all_files( @router.get( "/find/{prefix}", - response_model=list[str], responses=_fp.responses, ) async def find_files_by_prefix( @@ -74,8 +72,8 @@ async def find_files_by_prefix( @router.get( "/get/{prefix}", - response_class=StreamingResponse, responses=_fpu.responses, + response_class=StreamingResponse, ) async def get_file_by_prefix( prefix: str, diff --git a/api/ovdashboard_api/routers/v1/image.py b/api/ovdashboard_api/routers/v1/image.py index 5345d80..c0adf47 100644 --- a/api/ovdashboard_api/routers/v1/image.py +++ b/api/ovdashboard_api/routers/v1/image.py @@ -53,7 +53,6 @@ async def start_router() -> None: @router.get( "/list", - response_model=list[str], responses=_ls.responses, ) async def list_all_images( @@ -64,7 +63,6 @@ async def list_all_images( @router.get( "/find/{prefix}", - response_model=list[str], responses=_fp.responses, ) async def find_images_by_prefix( @@ -75,8 +73,8 @@ async def find_images_by_prefix( @router.get( "/get/{prefix}", - response_class=StreamingResponse, responses=_fpu.responses, + response_class=StreamingResponse, ) async def get_image_by_prefix( prefix: str, @@ -97,10 +95,7 @@ async def get_image_by_prefix( ) -@router.get( - "/config", - response_model=ImageUIConfig, -) +@router.get("/config") async def get_ui_config( cfg: Config = Depends(get_config), ) -> ImageUIConfig: diff --git a/api/ovdashboard_api/routers/v1/misc.py b/api/ovdashboard_api/routers/v1/misc.py index 0657f18..5e06169 100644 --- a/api/ovdashboard_api/routers/v1/misc.py +++ b/api/ovdashboard_api/routers/v1/misc.py @@ -46,20 +46,14 @@ async def get_version() -> str: return version("ovdashboard-api") -@router.get( - "/config/server", - response_model=ServerUIConfig, -) +@router.get("/config/server") async def get_server_ui_config( cfg: Config = Depends(get_config), ) -> ServerUIConfig: return cfg.server -@router.get( - "/config/logo", - response_model=LogoUIConfig, -) +@router.get("/config/logo") async def get_logo_ui_config( cfg: Config = Depends(get_config), ) -> LogoUIConfig: diff --git a/api/ovdashboard_api/routers/v1/text.py b/api/ovdashboard_api/routers/v1/text.py index 91aa0a2..89111b0 100644 --- a/api/ovdashboard_api/routers/v1/text.py +++ b/api/ovdashboard_api/routers/v1/text.py @@ -51,7 +51,6 @@ async def start_router() -> None: @router.get( "/list", - response_model=list[str], responses=_ls.responses, ) async def list_all_texts( @@ -62,7 +61,6 @@ async def list_all_texts( @router.get( "/find/{prefix}", - response_model=list[str], responses=_fp.responses, ) async def find_texts_by_prefix( @@ -80,7 +78,6 @@ async def _get_raw_text_by_prefix( @router.get( "/get/raw/{prefix}", - response_model=str, responses=_fpu.responses, ) async def get_raw_text_by_prefix( @@ -91,7 +88,6 @@ async def get_raw_text_by_prefix( @router.get( "/get/html/{prefix}", - response_model=str, responses=_fpu.responses, ) async def get_html_by_prefix( diff --git a/api/ovdashboard_api/routers/v1/ticker.py b/api/ovdashboard_api/routers/v1/ticker.py index 7c2e04a..949fa6f 100644 --- a/api/ovdashboard_api/routers/v1/ticker.py +++ b/api/ovdashboard_api/routers/v1/ticker.py @@ -83,10 +83,7 @@ async def get_raw_ticker( return ticker_content -@router.get( - "/config", - response_model=TickerUIConfig, -) +@router.get("/config") async def get_ui_config( cfg: Config = Depends(get_config), ) -> TickerUIConfig: