Spaces:
Sleeping
Sleeping
Update api/routes/auth.py
Browse files- api/routes/auth.py +9 -19
api/routes/auth.py
CHANGED
|
@@ -123,26 +123,16 @@ async def login(form_data: OAuth2PasswordRequestForm = Depends()):
|
|
| 123 |
|
| 124 |
@router.get("/me")
|
| 125 |
async def get_me(current_user: dict = Depends(get_current_user)):
|
| 126 |
-
logger.info(f"
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
)
|
| 134 |
-
|
| 135 |
-
response = {
|
| 136 |
-
"id": str(user["_id"]),
|
| 137 |
-
"email": user["email"],
|
| 138 |
-
"full_name": user.get("full_name", ""),
|
| 139 |
-
"role": user.get("role", "patient"),
|
| 140 |
-
"specialty": user.get("specialty"),
|
| 141 |
-
"created_at": user.get("created_at"),
|
| 142 |
-
"updated_at": user.get("updated_at")
|
| 143 |
}
|
| 144 |
-
logger.info(f"User profile retrieved for {current_user['email']}")
|
| 145 |
-
return response
|
| 146 |
|
| 147 |
# Export the router as 'auth' for api.__init__.py
|
| 148 |
auth = router
|
|
|
|
| 123 |
|
| 124 |
@router.get("/me")
|
| 125 |
async def get_me(current_user: dict = Depends(get_current_user)):
|
| 126 |
+
logger.info(f"Returning cached user: {current_user['email']}")
|
| 127 |
+
return {
|
| 128 |
+
"id": str(current_user.get('_id', '')),
|
| 129 |
+
"email": current_user["email"],
|
| 130 |
+
"full_name": current_user.get("full_name", ""),
|
| 131 |
+
"role": current_user.get("role", "patient"),
|
| 132 |
+
"specialty": current_user.get("specialty"),
|
| 133 |
+
"created_at": current_user.get("created_at"),
|
| 134 |
+
"updated_at": current_user.get("updated_at")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
}
|
|
|
|
|
|
|
| 136 |
|
| 137 |
# Export the router as 'auth' for api.__init__.py
|
| 138 |
auth = router
|