Update code in endpoints/api/v1/endpoint.post.py

This commit is contained in:
Backend IM Bot 2025-03-19 09:07:50 +00:00
parent e7219ff2c3
commit aa79fb5cd2

View File

@ -9,9 +9,9 @@ class UserRegistration(BaseModel):
username: str
email: EmailStr
password: str
full_name: str | None = None
full_name: str
@router.post("/register")
@router.post("/api/v1/endpoint")
async def register_user(user_data: UserRegistration):
"""Register a new user"""
if user_data.username in fake_users_db:
@ -21,23 +21,22 @@ async def register_user(user_data: UserRegistration):
fake_users_db[user_data.username] = {
"id": user_id,
"email": user_data.email,
"password": user_data.password, # In production, hash this password
"password": user_data.password,
"full_name": user_data.full_name,
"disabled": False,
"created_at": str(datetime.now())
"disabled": False
}
return {
"message": "User registered successfully",
"user_id": user_id,
"username": user_data.username,
"metadata": {
"account_status": "active",
"registration_complete": True
},
"next_steps": [
"Verify your email address",
"Complete your profile",
"Set up two-factor authentication"
],
"metadata": {
"account_status": "pending_verification",
"registration_date": str(datetime.now())
}
]
}