♻️ Refactor email logic to allow re-using util functions for testing and development (#663)
This commit is contained in:

committed by
GitHub

parent
c048a61d81
commit
d4e35a0dfd
@@ -4,7 +4,7 @@ from pydantic.networks import EmailStr
|
||||
from app.api.deps import get_current_active_superuser
|
||||
from app.core.celery_app import celery_app
|
||||
from app.models import Message
|
||||
from app.utils import send_test_email
|
||||
from app.utils import generate_test_email, send_email
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@@ -31,5 +31,10 @@ def test_email(email_to: EmailStr) -> Message:
|
||||
"""
|
||||
Test emails.
|
||||
"""
|
||||
send_test_email(email_to=email_to)
|
||||
email_data = generate_test_email(email_to=email_to)
|
||||
send_email(
|
||||
email_to=email_to,
|
||||
subject=email_data.subject,
|
||||
html_content=email_data.html_content,
|
||||
)
|
||||
return Message(message="Test email sent")
|
||||
|
Reference in New Issue
Block a user