diff --git a/endpoints/email.post.py b/endpoints/email.post.py index 2f3334d..90c2a7e 100644 --- a/endpoints/email.post.py +++ b/endpoints/email.post.py @@ -12,10 +12,10 @@ async def submit_contact_form( db: Session = Depends(get_db) ): """ - Submit a contact form with name, email, and message. + Submit a new contact form with name, email, and message. All fields are required and email must be in valid format. """ - # Validate the contact form data + # Validate the form data errors = validate_contact_form_data({ "name": contact_form.name, "email": contact_form.email, @@ -29,10 +29,15 @@ async def submit_contact_form( detail=errors ) - # Create the contact form entry in the database - create_contact_form(db=db, contact_form_data=contact_form) + # Create the contact form in the database + created_form = create_contact_form(db=db, contact_form_data=contact_form) return { "status": "success", - "message": "Contact form submitted successfully" + "message": "Contact form submitted successfully", + "data": { + "id": created_form.id, + "name": created_form.name, + "email": created_form.email + } } \ No newline at end of file