Update code in endpoints/string.post.py
This commit is contained in:
parent
1c1667f15c
commit
c96535006d
34
endpoints/string.post.py
Normal file
34
endpoints/string.post.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
from fastapi import APIRouter, Depends, HTTPException
|
||||||
|
from core.database import fake_users_db
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
@router.post("/signup")
|
||||||
|
async def signup_handler(
|
||||||
|
username: str,
|
||||||
|
email: str,
|
||||||
|
password: str,
|
||||||
|
db: Session = Depends(get_db)
|
||||||
|
):
|
||||||
|
"""Demo signup endpoint"""
|
||||||
|
if username in fake_users_db:
|
||||||
|
raise HTTPException(status_code=400, detail="Username already exists")
|
||||||
|
|
||||||
|
user_id = str(uuid.uuid4())
|
||||||
|
fake_users_db[username] = {
|
||||||
|
"id": user_id,
|
||||||
|
"email": email,
|
||||||
|
"password": password,
|
||||||
|
"disabled": False
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
"message": "User created successfully",
|
||||||
|
"user_id": user_id,
|
||||||
|
"username": username,
|
||||||
|
"next_steps": [
|
||||||
|
"Verify your email (demo)",
|
||||||
|
"Complete profile setup"
|
||||||
|
]
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user