Merged
Conversation
Abeeujah
approved these changes
Jul 30, 2025
Contributor
Abeeujah
left a comment
There was a problem hiding this comment.
Great Job with your implementation 👍
| .merge(project::router()) | ||
| .merge(support_ticket::router()) | ||
| .merge(escrow::router()) | ||
| .merge(newsletter::router()) |
| Unsubscribed, | ||
| Bounced, | ||
| SpamComplaint, | ||
| } |
src/http/newsletter/domain.rs
Outdated
| pub subscribed_at: Option<chrono::DateTime<chrono::Utc>>, | ||
| pub created_at: chrono::DateTime<chrono::Utc>, | ||
| pub updated_at: Option<chrono::DateTime<chrono::Utc>>, | ||
| } |
Contributor
There was a problem hiding this comment.
Great job with the domain modelling. 👍
| "/newsletter/verify", | ||
| post(verify_subscriber::verify_subscriber), | ||
| ) | ||
| } |
| .await?; | ||
|
|
||
| Ok(()) | ||
| } |
Contributor
There was a problem hiding this comment.
Great Job with this implementation, the thought process, the modularization, everything, you did a great job 👍
| let res = app.request(req).await; | ||
|
|
||
| assert_eq!(res.status(), StatusCode::BAD_REQUEST); | ||
| } |
Contributor
There was a problem hiding this comment.
Great Job with the tests, it's exhaustive and covers happy paths and known edge cases well 👍
Contributor
|
@anonfedora Pls fix the conflict |
Contributor
|
@anonfedora Pls your test is not passing. Make it to pass |
ONEONUORA
approved these changes
Jul 30, 2025
Contributor
ONEONUORA
left a comment
There was a problem hiding this comment.
Nice implementation @anonfedora Keep up the good work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Newsletter Subscriber Verification Feature
🎯 Overview
Closes #105
This PR implements a newsletter subscriber verification system that allows subscribers to verify their subscription by providing a token sent to them during signup. This prevents spam and ensures only verified subscribers receive newsletters.
📋 Features
🚀 API Endpoint
Verify Subscriber
Request Body:
{ "token": "verification-token-123" }Success Response (200):
{ "message": "Subscriber successfully verified", "subscriber_id": "0198525e-16e4-7851-bd17-a2eab39641b9", "email": "user@example.com", "verified_at": "2025-07-28T18:49:14.730Z" }Error Responses:
400 Bad Request- Empty or invalid token format404 Not Found- Token not found or expired422 Unprocessable Entity- Subscriber already verified📁 Files Added/Modified
New Files
src/http/newsletter/mod.rs- Newsletter module routersrc/http/newsletter/domain.rs- Domain types and enumssrc/http/newsletter/verify_subscriber.rs- Verification endpointtests/api/newsletter.rs- Comprehensive test suiteModified Files
src/http/mod.rs- Added newsletter module to main routertests/api/main.rs- Added newsletter test module🗄️ Database Schema
The feature uses the existing newsletter schema:
🔍 Sample Queries
1. Create a New Subscriber
2. Verify Subscriber
3. Check Subscriber Status
4. Clean Up Expired Tokens
5. Newsletter Distribution Query
🧪 Test Coverage
Test Cases
Test Results
🔧 Implementation Details
Domain Types
Key Functions
verify_subscriber()- Main endpoint handlerfind_subscriber_by_token()- Database query with proper error handlingupdate_subscriber_status()- Atomic status update🛡️ Security Features
📈 Performance Considerations
subscription_tokentable✅ Checklist
Ready for review and merge! 🎉