diff --git a/endpoints/customer.post.py b/endpoints/customer.post.py index e69de29..93b5c5a 100644 --- a/endpoints/customer.post.py +++ b/endpoints/customer.post.py @@ -0,0 +1,36 @@ +from fastapi import APIRouter, HTTPException +import uuid + +customers = [] # In-memory storage + +router = APIRouter() + +@router.post("/customer") +async def create_customer( + email: str = "customer@example.com", + name: str = "John Doe", + location: str = "New York", + gender: str = "male" +): + """Create new customer endpoint""" + if any(c["email"] == email for c in customers): + raise HTTPException(status_code=400, detail="Email already exists") + + customer_id = str(uuid.uuid4()) + customers.append({ + "id": customer_id, + "email": email, + "name": name, + "location": location, + "gender": gender + }) + + return { + "message": "Customer created successfully", + "customer_id": customer_id, + "email": email, + "next_steps": [ + "Complete customer profile", + "Add payment method" + ] + } \ No newline at end of file