From 6c75e9e6c4412b692cb4468c7bfe193a0cc1b90b Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 21 Mar 2025 09:43:12 +0000 Subject: [PATCH] Update code in endpoints/signup.post.py --- endpoints/signup.post.py | 67 ++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 41 deletions(-) diff --git a/endpoints/signup.post.py b/endpoints/signup.post.py index 77e4d09..e3c728a 100644 --- a/endpoints/signup.post.py +++ b/endpoints/signup.post.py @@ -1,50 +1,35 @@ -from fastapi import APIRouter, HTTPException, Depends -from sqlalchemy.orm import Session -from pydantic import BaseModel -from core.database import get_db -from core.auth import get_password_hash, create_access_token +from fastapi import APIRouter, HTTPException import uuid -from models.user import User + +contacts = [] # In-memory storage router = APIRouter() -class UserCreate(BaseModel): - username: str - email: str - password: str - @router.post("/signup") -async def signup( - user_data: UserCreate, - db: Session = Depends(get_db) +async def signup_ngo( + name: str = "Organization Name", + email: str = "org@example.com", + phone: str = "123-456-7890" ): - """User registration endpoint""" - # Check existing user - db_user = db.query(User).filter( - (User.username == user_data.username) | - (User.email == user_data.email) - ).first() - - if db_user: - raise HTTPException( - status_code=400, - detail="Username or email already exists" - ) + """NGO signup endpoint""" + if any(c["email"] == email for c in contacts): + raise HTTPException(status_code=400, detail="Email already registered") - # Create new user - new_user = User( - id=str(uuid.uuid4()), - username=user_data.username, - email=user_data.email, - hashed_password=get_password_hash(user_data.password) - ) - - db.add(new_user) - db.commit() + contact_id = str(uuid.uuid4()) + contacts.append({ + "id": contact_id, + "name": name, + "email": email, + "phone": phone, + "status": "pending" + }) - # Return token directly after registration return { - "message": "User created successfully", - "access_token": create_access_token({"sub": new_user.id}), - "token_type": "bearer" - } + "message": "Contact request submitted successfully", + "contact_id": contact_id, + "name": name, + "next_steps": [ + "Check email for confirmation", + "Schedule orientation call" + ] + } \ No newline at end of file