Skip to content

Conversation

@ShashankShekhar07
Copy link
Contributor

@ShashankShekhar07 ShashankShekhar07 commented Oct 27, 2025

What does this PR do?

Solves: #3183

This PR adds email verification functionality to the Gin–MongoDB pipeline.
It introduces a verification endpoint that validates user emails using the AfterShip/email-verifier library before allowing them into the system. This ensures data accuracy and prevents invalid or unreachable email addresses from being stored in the MongoDB collection.

Copilot AI review requested due to automatic review settings October 27, 2025 11:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds email verification functionality to the Gin-MongoDB pipeline using the AfterShip/email-verifier library. The implementation introduces a new GET endpoint /verify-email that validates email syntax and reachability before allowing data to be stored in MongoDB, improving data quality and preventing invalid email addresses from entering the system.

Key changes:

  • Added email verification endpoint with comprehensive validation logic
  • Updated Go version from 1.17 to 1.22 with appropriate toolchain configuration
  • Fixed logger initialization to use package-level variable

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
gin-mongo/main.go Fixed logger initialization and registered new email verification endpoint
gin-mongo/handler.go Implemented verifyEmail handler with syntax and reachability checks
gin-mongo/go.mod Upgraded Go version to 1.22 and added email-verifier dependency
gin-mongo/keploy/.gitignore Added reports directory to gitignore
gin-mongo/keploy.yml Added Keploy configuration file for testing
Comments suppressed due to low confidence (1)

gin-mongo/go.mod:1

  • Corrected spelling of 'configration' to 'configuration'.
module test-app-url-shortener

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

response.Valid = false
response.Reachable = false
response.Message = "Email syntax is invalid"
} else if result.Reachable == "no" {
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

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

The string comparison result.Reachable == \"no\" is fragile and prone to errors. Consider using constants or an enum-like type for the Reachable field values to make the code more maintainable and less error-prone. For example, define constants like ReachableNo, ReachableYes, ReachableUnknown based on the email-verifier library's documentation.

Copilot uses AI. Check for mistakes.
Signed-off-by: Shashank Shekhar <[email protected]>
Signed-off-by: Shashank Shekhar <[email protected]>
Signed-off-by: Shashank Shekhar <[email protected]>
dbName, collection := "keploy", "url-shortener"

client, err := New("mongoDb:27017", dbName)
client, err := New("localhost:27017", dbName)
Copy link
Member

Choose a reason for hiding this comment

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

please change it back to mongodb

func main() {
time.Sleep(2 * time.Second)
logger, _ := zap.NewProduction()
logger, _ = zap.NewProduction()
Copy link
Member

Choose a reason for hiding this comment

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

why was this change made?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants