From 7f53c8addfe4a5c344e63373aa90b888f803b75d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A5=D0=BB=D0=B8?= =?UTF-8?q?=D0=BC=D0=B0=D0=BD=D0=B5=D0=BD=D0=BA=D0=BE=D0=B2?= Date: Fri, 28 Jun 2024 20:19:41 +0300 Subject: [PATCH 1/3] fix error: AttributeError: module "bcrypt" has no attribute __about__ --- app/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/requirements.txt b/app/requirements.txt index d4286b2..cab9f36 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -13,7 +13,7 @@ asyncpg==0.29.0 attrs==23.1.0 Babel==2.14.0 backcall==0.2.0 -bcrypt==4.1.1 +bcrypt==4.0.1 black==23.12.0 certifi==2023.11.17 cffi==1.16.0 From 7039907783bc3b14b4a18ac7a5b21ddb65c6c013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A5=D0=BB=D0=B8?= =?UTF-8?q?=D0=BC=D0=B0=D0=BD=D0=B5=D0=BD=D0=BA=D0=BE=D0=B2?= Date: Fri, 28 Jun 2024 20:33:22 +0300 Subject: [PATCH 2/3] =?UTF-8?q?=D0=92=20=D0=BE=D1=82=D0=B2=D0=B5=D1=82?= =?UTF-8?q?=D0=B5=20=D0=BF=D1=80=D0=B8=20=D1=80=D0=B5=D0=B3=D0=B8=D1=81?= =?UTF-8?q?=D1=82=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20=D1=8E=D0=B7=D0=B5=D1=80?= =?UTF-8?q?=D0=B0=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B8=D0=BB=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D0=B5=20role?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/endpoints/user.py | 4 ++-- app/api_docs_responses/register.py | 1 - app/core/user.py | 2 +- app/schemas/user.py | 13 ++++++++----- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/api/endpoints/user.py b/app/api/endpoints/user.py index 21f76ee..555104b 100644 --- a/app/api/endpoints/user.py +++ b/app/api/endpoints/user.py @@ -11,7 +11,7 @@ from app.core.db import get_async_session from app.core.user import auth_backend, fastapi_users from app.crud.user import user_crud -from app.schemas.user import UserCreate, UserRead, UserUpdate +from app.schemas.user import UserCreate, UserRead, UserReadRegister, UserUpdate from app.services.token_generator.tokens import token_generator router = APIRouter() @@ -24,7 +24,7 @@ router.include_router( register.get_register_router( - UserRead, + UserReadRegister, Annotated[UserCreate, Body(example=USER_VALUE)] ), prefix='/auth', diff --git a/app/api_docs_responses/register.py b/app/api_docs_responses/register.py index a401c36..cb0966c 100644 --- a/app/api_docs_responses/register.py +++ b/app/api_docs_responses/register.py @@ -11,7 +11,6 @@ 'is_active': True, 'is_superuser': True, 'is_verified': False, - 'role': 'user', 'username': 'Имя', 'tariff_id': 0 } diff --git a/app/core/user.py b/app/core/user.py index 998a2d3..f5dc2a8 100644 --- a/app/core/user.py +++ b/app/core/user.py @@ -67,7 +67,7 @@ async def on_after_register( 'Welcome to QActf.', f'{URL}/auth/confirm/{user_uid}/{user_code}', ) - await cofirm_email.send_email_message() + # await cofirm_email.send_email_message() async def get_user_manager(user_db=Depends(get_user_db)): diff --git a/app/schemas/user.py b/app/schemas/user.py index efa3173..9ddff31 100644 --- a/app/schemas/user.py +++ b/app/schemas/user.py @@ -8,11 +8,7 @@ from app.core.constants import Role -class UserRead(schemas.BaseUser[int]): - role: Annotated[ - Choice, - WithJsonSchema({'type': 'str'}) - ] +class UserReadRegister(schemas.BaseUser[int]): username: str tariff_id: Optional[int] @@ -20,6 +16,13 @@ class Config: from_attributes = True arbitrary_types_allowed = True + +class UserRead(UserReadRegister): + role: Annotated[ + Choice, + WithJsonSchema({'type': 'str'}) + ] + @field_serializer('role') def serialize_role(self, role: Choice, _info): return role.code From c6147fb6702ad0b8aac2ff98df415f64151956f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A5=D0=BB=D0=B8?= =?UTF-8?q?=D0=BC=D0=B0=D0=BD=D0=B5=D0=BD=D0=BA=D0=BE=D0=B2?= Date: Mon, 8 Jul 2024 12:11:21 +0300 Subject: [PATCH 3/3] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B2=D0=BE=D0=B3=D0=BE=20=D1=80=D0=B5=D0=B2?= =?UTF-8?q?=D1=8C=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/user.py | 2 +- app/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/core/user.py b/app/core/user.py index f5dc2a8..998a2d3 100644 --- a/app/core/user.py +++ b/app/core/user.py @@ -67,7 +67,7 @@ async def on_after_register( 'Welcome to QActf.', f'{URL}/auth/confirm/{user_uid}/{user_code}', ) - # await cofirm_email.send_email_message() + await cofirm_email.send_email_message() async def get_user_manager(user_db=Depends(get_user_db)): diff --git a/app/requirements.txt b/app/requirements.txt index cab9f36..d4286b2 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -13,7 +13,7 @@ asyncpg==0.29.0 attrs==23.1.0 Babel==2.14.0 backcall==0.2.0 -bcrypt==4.0.1 +bcrypt==4.1.1 black==23.12.0 certifi==2023.11.17 cffi==1.16.0