initial commit

This commit is contained in:
Lucas Jensen
2024-05-01 09:19:01 -07:00
commit 5d67c0c2b2
117 changed files with 9917 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
from fastapi import APIRouter, status
from app.admin.contact import send_email
from app.models.contact import Contact
router = APIRouter(
prefix="/contact",
tags=["contact"],
responses={404: {"description": "Not found"}},
)
@router.post("/", status_code=status.HTTP_201_CREATED)
async def post_message(contact: Contact):
"""Sends an email to the site owner with the provided name, email, and message."""
subject = f"New message from {contact.name}"
body = f"From: {contact.email}\n\n{contact.message}"
send_email(subject, body)