- Add findagram.co React frontend with product search, brands, categories - Add findadispo.com React frontend with dispensary locator - Wire findagram to backend /api/az/* endpoints - Update category/brand links to route to /products with filters - Add k8s manifests for both frontends - Add multi-domain user support migrations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
50 lines
1.0 KiB
Python
50 lines
1.0 KiB
Python
from fastapi import APIRouter, Depends, status
|
|
from sqlalchemy.orm import Session
|
|
from pydantic import BaseModel, EmailStr
|
|
|
|
from database import get_db
|
|
from models import ContactMessage
|
|
|
|
router = APIRouter(prefix="/contact", tags=["Contact"])
|
|
|
|
|
|
class ContactCreate(BaseModel):
|
|
name: str
|
|
email: EmailStr
|
|
subject: str
|
|
message: str
|
|
|
|
|
|
class ContactResponse(BaseModel):
|
|
id: int
|
|
name: str
|
|
email: str
|
|
subject: str
|
|
message: str
|
|
created_at: str
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
@router.post("/", status_code=status.HTTP_201_CREATED)
|
|
def submit_contact(
|
|
contact_data: ContactCreate,
|
|
db: Session = Depends(get_db)
|
|
):
|
|
"""Submit a contact form message"""
|
|
message = ContactMessage(
|
|
name=contact_data.name,
|
|
email=contact_data.email,
|
|
subject=contact_data.subject,
|
|
message=contact_data.message
|
|
)
|
|
db.add(message)
|
|
db.commit()
|
|
db.refresh(message)
|
|
|
|
return {
|
|
"message": "Thank you for your message! We'll get back to you soon.",
|
|
"id": message.id
|
|
}
|