gavinzli's picture
Update Dockerfile and refactor FastAPI routers for consistency
f06d4d5
raw
history blame
851 Bytes
"""Module for defining the main routes of the API."""
from fastapi import APIRouter
from fastapi.responses import JSONResponse
from controllers import mail
router = APIRouter(prefix="/mail", tags=["mail"])
@router.post("")
def collect():
"""
Handles the chat POST request.
Args:
query (ReqData): The request data containing the query parameters.
Returns:
str: The generated response from the chat function.
"""
mail.collect()
return JSONResponse(content={"message": "Mail collected successfully."})
@router.get("")
def get():
"""
Handles the chat POST request.
Args:
query (ReqData): The request data containing the query parameters.
Returns:
str: The generated response from the chat function.
"""
result = mail.get()
return JSONResponse(content= result)