From 03c73bfd0d32638276a0ab0c1a9121e0c60c966f Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Tue, 25 Mar 2025 13:01:11 +0000 Subject: [PATCH] Update code in endpoints/customer.post.py --- endpoints/customer.post.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) 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