From 712c5ec83b76535706148bf7dc03d5901f59623f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 19 Sep 2025 19:59:07 +0300 Subject: [PATCH] rework --- common_lib/services/profile.py | 6 ++++-- common_lib/utils/auth.py | 3 ++- pyproject.toml | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/common_lib/services/profile.py b/common_lib/services/profile.py index 7c33af4..bad517e 100644 --- a/common_lib/services/profile.py +++ b/common_lib/services/profile.py @@ -20,7 +20,8 @@ async def get_profile_by_user_id(user_id: UUID, token: str) -> dict: detail=f"profile_service: {response.text}" ) - return response.json() + wrapped = response.json() + return wrapped["data"] except httpx.RequestError: raise HTTPException(status_code=status.HTTP_503_SERVICE_UNAVAILABLE, detail="Token service unavailable") @@ -41,7 +42,8 @@ async def get_profiles_by_user_ids(user_ids: List[UUID], token: str, user_id: UU detail=f"profile_service: {response.text}" ) - return response.json() + wrapped = response.json() + return wrapped["data"] except httpx.RequestError as e: raise HTTPException(status_code=status.HTTP_503_SERVICE_UNAVAILABLE, detail=f"profile_service unreachable: {str(e)}") diff --git a/common_lib/utils/auth.py b/common_lib/utils/auth.py index 83fab8f..aa57776 100644 --- a/common_lib/utils/auth.py +++ b/common_lib/utils/auth.py @@ -47,7 +47,8 @@ async def _fetch_current_user( detail=f"token_service: {response.text}" ) - data = response.json() + wrapped = response.json() + data = wrapped["data"] return CurrentUser( token=token, diff --git a/pyproject.toml b/pyproject.toml index b86b41f..284318c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "common-lib" -version = "0.0.17" +version = "0.0.18" description = "Библиотека общих компонентов для микросервисов yobble" authors = [{ name = "cheykrym", email = "you@example.com" }] license = "MIT"