From c96535006dd15b9c59b31c7cf0a609c4966f352c Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 14 Mar 2025 09:19:04 -0500 Subject: [PATCH] Update code in endpoints/string.post.py --- endpoints/string.post.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 endpoints/string.post.py diff --git a/endpoints/string.post.py b/endpoints/string.post.py new file mode 100644 index 0000000..17d8526 --- /dev/null +++ b/endpoints/string.post.py @@ -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" + ] + } \ No newline at end of file