From a99cc389c8748e724713e2b430260857d366ea43 Mon Sep 17 00:00:00 2001 From: AlanPaine Date: Tue, 31 Mar 2026 07:17:47 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/api/endpoints/users.py | 2 +- backend/app/models/models.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/app/api/endpoints/users.py b/backend/app/api/endpoints/users.py index d9f9507..12902d2 100644 --- a/backend/app/api/endpoints/users.py +++ b/backend/app/api/endpoints/users.py @@ -96,7 +96,7 @@ def create_user(request: CreateUserRequest, current_user: dict = Depends(get_cur if current_user['role_id'] != 1: # 1 is admin return create_api_response(code="403", message="仅管理员有权限创建用户") - if not validate_email(request.email): + if request.email and not validate_email(request.email): return create_api_response(code="400", message="邮箱格式不正确") with get_db_connection() as connection: diff --git a/backend/app/models/models.py b/backend/app/models/models.py index 199ecb4..22a8d50 100644 --- a/backend/app/models/models.py +++ b/backend/app/models/models.py @@ -34,6 +34,7 @@ class CreateUserRequest(BaseModel): password: Optional[str] = None caption: str email: Optional[str] = None + avatar_url: Optional[str] = None role_id: int = 2 class UpdateUserRequest(BaseModel):