feat: Update endpoint register
This commit is contained in:
parent
aa79fb5cd2
commit
e96d65629f
@ -0,0 +1,42 @@
|
|||||||
|
from fastapi import APIRouter, Depends, HTTPException
|
||||||
|
from core.database import fake_users_db
|
||||||
|
from pydantic import BaseModel, EmailStr
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
class UserRegistration(BaseModel):
|
||||||
|
username: str
|
||||||
|
email: EmailStr
|
||||||
|
password: str
|
||||||
|
full_name: str
|
||||||
|
|
||||||
|
@router.post("/api/v1/endpoint")
|
||||||
|
async def register_user(user_data: UserRegistration):
|
||||||
|
"""Register a new user"""
|
||||||
|
if user_data.username in fake_users_db:
|
||||||
|
raise HTTPException(status_code=400, detail="Username already exists")
|
||||||
|
|
||||||
|
user_id = str(uuid.uuid4())
|
||||||
|
fake_users_db[user_data.username] = {
|
||||||
|
"id": user_id,
|
||||||
|
"email": user_data.email,
|
||||||
|
"password": user_data.password,
|
||||||
|
"full_name": user_data.full_name,
|
||||||
|
"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"
|
||||||
|
]
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user