Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Contact Us endpoints Api #163

Merged
merged 1 commit into from
Jul 22, 2024
Merged

Conversation

bertrandshema
Copy link
Contributor

@bertrandshema bertrandshema commented Jul 21, 2024

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

  • The POST /api/contact endpoint successfully sends an email and returns the correct status and response based on the request.
  • The endpoint validates input fields and returns appropriate error messages for missing fields.
  • All tests for the endpoint pass, covering both successful and error scenarios.
  • The API documentation is updated to include the new endpoint and its details.

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

@bertrandshema bertrandshema added backend Good for newcomers WIP Work In Progress labels Jul 21, 2024
@bertrandshema bertrandshema self-assigned this Jul 21, 2024
@bertrandshema bertrandshema linked an issue Jul 21, 2024 that may be closed by this pull request
5 tasks
@codecov-commenter
Copy link

codecov-commenter commented Jul 21, 2024

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 ⚠️
Additional details and impacted files
@@             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              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@ambroisegithub ambroisegithub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It Looks Good for merge!!!

@bertrandshema bertrandshema added Ready for TTL Review the PR is ready to be reviewed by the TTL/Manager and removed WIP Work In Progress labels Jul 21, 2024
Copy link
Contributor

@wayneleon1 wayneleon1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@dushimeemma dushimeemma merged commit 4844c5c into develop Jul 22, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Good for newcomers Ready for TTL Review the PR is ready to be reviewed by the TTL/Manager
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feat: Contact Us endpoints Api
8 participants