From a4039b75da212b81222bad71da62262d6dfb290c Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Thu, 20 Mar 2025 13:41:44 +0000 Subject: [PATCH] Update code in endpoints/signup.post.py --- endpoints/signup.post.py | 41 ++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/endpoints/signup.post.py b/endpoints/signup.post.py index 47f7fae..b0f55e1 100644 --- a/endpoints/signup.post.py +++ b/endpoints/signup.post.py @@ -1,33 +1,46 @@ -from fastapi import APIRouter, HTTPException +from fastapi import APIRouter, Depends, HTTPException from core.database import fake_users_db import uuid router = APIRouter() @router.post("/signup") -async def signup_demo( - username: str = "new_user", +async def signup_handler( email: str = "user@example.com", - password: str = "securepassword123" + password: str = "securepassword123", + name: str = "User Name", + company: str = "Company Name" ): - """Demo signup endpoint""" - if username in fake_users_db: - raise HTTPException(status_code=400, detail="Username already exists") + """Demo signup endpoint for initial registration""" + + if any(user["email"] == email for user in fake_users_db.values()): + raise HTTPException(status_code=400, detail="Email already registered") user_id = str(uuid.uuid4()) + username = email.split("@")[0] + fake_users_db[username] = { "id": user_id, "email": email, "password": password, - "disabled": False + "name": name, + "company": company, + "disabled": False, + "verified": False } return { - "message": "User created successfully", + "message": "Registration initiated successfully", "user_id": user_id, - "username": username, + "email": email, "next_steps": [ - "Verify your email (demo)", - "Complete profile setup" - ] - } + "Check your email for verification link", + "Complete company profile", + "Set up team members" + ], + "metadata": { + "registration_status": "pending_verification", + "account_type": "business", + "created_at": "2024-01-01T00:00:00Z" + } + } \ No newline at end of file