Update code in endpoints/profile.get.py
This commit is contained in:
parent
3e9be1e82c
commit
bb42209dc4
@ -0,0 +1,29 @@
|
|||||||
|
from fastapi import APIRouter, HTTPException
|
||||||
|
|
||||||
|
users = [] # In-memory storage
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
@router.get("/profile")
|
||||||
|
async def get_profile(
|
||||||
|
firstname: str = "John",
|
||||||
|
lastname: str = "Doe",
|
||||||
|
email: str = "john@example.com"
|
||||||
|
):
|
||||||
|
"""Get user profile endpoint"""
|
||||||
|
user = next((u for u in users if u["email"] == email), None)
|
||||||
|
if not user:
|
||||||
|
raise HTTPException(status_code=404, detail="Profile not found")
|
||||||
|
|
||||||
|
return {
|
||||||
|
"message": "Profile retrieved successfully",
|
||||||
|
"user": {
|
||||||
|
"firstname": firstname,
|
||||||
|
"lastname": lastname,
|
||||||
|
"email": email
|
||||||
|
},
|
||||||
|
"features": {
|
||||||
|
"profile_complete": True,
|
||||||
|
"verified": False
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user