first commit

This commit is contained in:
2026-03-06 13:31:28 +08:00
commit e125321cae
42 changed files with 17645 additions and 0 deletions

33
backend-py/main.py Normal file
View File

@@ -0,0 +1,33 @@
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from pydantic import BaseModel
app = FastAPI()
# Enable CORS for NestJS (or directly for React if you prefer)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # In production, restrict this to your NestJS server domain
allow_methods=["*"],
allow_headers=["*"],
)
# Hardcoded Leads Data
LEADS = [
{"id": 1, "name": "Alex Rivera", "email": "alex@company.com"},
{"id": 2, "name": "Jordan Smith", "email": "jsmith@leads.io"},
]
@app.get("/leads")
def get_leads():
return {"leads": LEADS}
class FeedbackData(BaseModel):
status: str
reason: str
@app.post("/leads/{lead_id}/feedback")
def receive_feedback(lead_id: str, feedback: FeedbackData):
# Now FastAPI knows exactly what structure to look for
print(f"Received feedback for {lead_id}: {feedback.status}, {feedback.reason}")
return {"status": "success"}