atlp-rwanda / dynamites-ecomm-be

Api Doc
https://dynamites-ecomm-be.onrender.com/api-docs/
0 stars 0 forks source link

Feat: Contact Us endpoints Api #163

Closed bertrandshema closed 4 months ago

bertrandshema commented 4 months ago

Overview

This pull request implements the API endpoints to handle user contact submissions via a form. Instead of storing submissions in a database, the submissions are sent via email to administrators.

Tasks

  1. Create Endpoint: Implemented POST /api/contact to handle the contact form submission and send an email to administrators.

  2. Email Template and Nodemailer Integration: Created an email template and integrated it with Nodemailer to send emails.

  3. Validation: Added validation to ensure all required fields (name, email, and message) are provided in the request body.

  4. Testing: Created tests for the endpoint to ensure that emails are sent correctly and errors are handled appropriately.

  5. API Documentation: Updated Swagger API documentation to include the new endpoint and its specifications.

Acceptance Criteria

How to Test

  1. checkout to the branch
  2. Start the server: npm run dev
  3. Use a tool like Postman or cURL to send POST requests to the /api/v1/contact endpoint with the required fields (name, email, phone, message).

Screenshots

Screenshot_21-7-2024_202546_localhost Screenshot 2024-07-21 202656

codecov-commenter commented 4 months ago

Codecov Report

Attention: Patch coverage is 84.21053% with 3 lines in your changes missing coverage. Please review.

Project coverage is 86.26%. Comparing base (189d16f) to head (9ab0a9b). Report is 1 commits behind head on develop.

Files Patch % Lines
src/controller/contactController.ts 70.00% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #163 +/- ## =========================================== - Coverage 86.33% 86.26% -0.08% =========================================== Files 65 67 +2 Lines 1764 1791 +27 Branches 193 196 +3 =========================================== + Hits 1523 1545 +22 - Misses 214 219 +5 Partials 27 27 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.