root 1 ヶ月 前
コミット
c8598f557a
共有2 個のファイルを変更した16 個の追加16 個の削除を含む
  1. 10
    10
      app/api/v1/auth.py
  2. 6
    6
      app/services/user_service.py

+ 10
- 10
app/api/v1/auth.py ファイルの表示

@@ -59,7 +59,7 @@ async def register(
59 59
                 "user_id": user.id,
60 60
                 "type": "refresh"
61 61
             },
62
-            expires_days=7
62
+            expires_days = 7
63 63
         )
64 64
         
65 65
         # 构建用户响应
@@ -75,22 +75,22 @@ async def register(
75 75
         }
76 76
         
77 77
         return TokenResponse(
78
-            access_token=access_token,
79
-            token_type="bearer",
80
-            expires_in=settings.ACCESS_TOKEN_EXPIRE_MINUTES * 60,
81
-            refresh_token=refresh_token,
82
-            user=user_response
78
+            access_token = access_token,
79
+            token_type = "bearer",
80
+            expires_in = settings.ACCESS_TOKEN_EXPIRE_MINUTES * 60,
81
+            refresh_token = refresh_token,
82
+            user = user_response
83 83
         )
84 84
         
85 85
     except ValueError as e:
86 86
         raise HTTPException(
87
-            status_code=status.HTTP_400_BAD_REQUEST,
88
-            detail=str(e)
87
+            status_code = status.HTTP_400_BAD_REQUEST,
88
+            detail = str(e)
89 89
         )
90 90
     except Exception as e:
91 91
         raise HTTPException(
92
-            status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
93
-            detail=f"注册失败: {str(e)}"
92
+            status_code = status.HTTP_500_INTERNAL_SERVER_ERROR,
93
+            detail = f"注册失败: {str(e)}"
94 94
         )
95 95
 
96 96
 @router.post("/login", response_model=TokenResponse)

+ 6
- 6
app/services/user_service.py ファイルの表示

@@ -43,12 +43,12 @@ class UserService:
43 43
         
44 44
         # 创建用户对象
45 45
         user = User(
46
-            username=user_data.username,
47
-            email=user_data.email,
48
-            hashed_password=hashed_password,
49
-            full_name=user_data.full_name,
50
-            is_active=True,
51
-            is_verified=False
46
+            username = user_data.username,
47
+            email = user_data.email,
48
+            hashed_password = hashed_password,
49
+            full_name = user_data.full_name,
50
+            is_active = True,
51
+            is_verified = False
52 52
         )
53 53
         
54 54
         # 异步保存