Skip to content

Conversation

@GideonBature
Copy link
Contributor

This PR adds a complete newsletter subscription system to the application, allowing users to subscribe with their email and name through a REST API endpoint.

Changes Made

Backend Implementation

  • New Module Structure: Created src/http/newsletter/ module with organized submodules:
    • domain.rs: Contains the NewsletterSubscriber struct
    • subscribe.rs: Handles subscription logic and database operations
    • mod.rs: Module organization and routing

API Endpoint

  • POST /newsletter/subscribe: New endpoint for newsletter subscriptions
    • Accepts JSON payload with email and name fields
    • Validates email format and name length (2-255 characters)
    • Returns 200 OK on successful subscription
    • Returns 422 Unprocessable Entity for validation errors

Testing

All tests pass and provide comprehensive coverage of the happy path and error scenarios. Run tests with:

cargo test

Closes #104

Copy link
Contributor

@ONEONUORA ONEONUORA left a comment

Choose a reason for hiding this comment

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

Nice implementation @GideonBature Keep up the good work

@ONEONUORA ONEONUORA merged commit 635361a into skill-mind:master Jul 30, 2025
3 checks passed
@GideonBature
Copy link
Contributor Author

Thank you ser!

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.

Subscribe Newsletter

3 participants