19 lines
637 B
Python
19 lines
637 B
Python
from fastapi import APIRouter, Depends, status
|
|
from sqlalchemy.orm import Session
|
|
from typing import Dict, Any
|
|
from core.database import get_db
|
|
from helpers.contact_form_helpers import handle_contact_form_submission
|
|
|
|
router = APIRouter()
|
|
|
|
@router.post("/form", status_code=status.HTTP_201_CREATED)
|
|
async def submit_contact_form(
|
|
form_data: Dict[str, Any],
|
|
db: Session = Depends(get_db)
|
|
):
|
|
"""
|
|
Endpoint to handle contact form submissions.
|
|
Requires name, email, and message fields.
|
|
Validates that all fields are provided and email is in valid format.
|
|
"""
|
|
return handle_contact_form_submission(db, form_data) |