Skip to content

Tast/ssad 93/create email microservice#114

Open
Darsicl wants to merge 32 commits into
devfrom
tast/SSAD-93/Create_EmailMicroservice
Open

Tast/ssad 93/create email microservice#114
Darsicl wants to merge 32 commits into
devfrom
tast/SSAD-93/Create_EmailMicroservice

Conversation

@Darsicl
Copy link
Copy Markdown
Contributor

@Darsicl Darsicl commented Mar 2, 2026

dev

JIRA

Code reviewers

Summary of issue

Implement microservice than sending feedbackEmail

Summary of change

Microservice Architecture: Developed a dedicated email microservice to decouple mail logic from the main API.
Integration: Implemented RabbitMQ (via MassTransit) for reliable data transfer between services.
Background Processing: Integrated Hangfire and MailKit for resilient asynchronous email delivery to Streetcode Admin.
DevOps: Added docker-compose configuration and environment setups for local and containerized development.
Refactoring: Fully migrated from the old Feedback entity to the new Email structure (including DB migrations) and removed legacy logic.
Quality: Verified the flow with unit tests and manual integration testing.

CHECK LIST

  • СI passed
  • Сode coverage >=95%
  • PR is reviewed manually again (to make sure you have 100% ready code)
  • All reviewers agreed to merge the PR
  • I've checked new feature as logged in and logged out user if needed
  • PR meets all conventions

@Darsicl Darsicl self-assigned this Mar 2, 2026
@Darsicl Darsicl added the task Regular task label Mar 2, 2026
Copy link
Copy Markdown
Contributor

@Sohatzk Sohatzk left a comment

Choose a reason for hiding this comment

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

Good work

Comment thread Streetcode/Streetcode.BLL/DTO/Email/EmailDTO.cs
Comment thread Streetcode/Streetcode.Email.BLL/DTO/EmailDTO.cs
Comment thread Streetcode/Streetcode.Email.BLL/Exceptions/ValidationException.cs
Comment thread Streetcode/Streetcode.Email.BLL/MediatR/Email/EmailDTOValidator.cs Outdated
Comment thread Streetcode/Streetcode.Email.BLL/MediatR/Email/SendEmailHandler.cs Outdated
Comment thread Streetcode/Streetcode.Email.WebAPI/Extensions/ServiceCollectionExtensions.cs Outdated
Comment thread Streetcode/Streetcode.Email.WebAPI/Extensions/ServiceCollectionExtensions.cs Outdated
Comment thread Streetcode/Streetcode.WebApi/Controllers/Email/EmailController.cs Outdated
@Darsicl Darsicl requested a review from Sohatzk March 2, 2026 12:33
Copy link
Copy Markdown
Contributor

@DrFaust555 DrFaust555 left a comment

Choose a reason for hiding this comment

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

Problems

  1. dockerpassword.env with password in repository

DB_PASSWORD=Strong_Pass_123!D32@
The password file is commiked. You need to delete it, add it to .gitignore, create .env.example.

  1. Main API does not register MassTransit
    EmailController now depends on IPublishEndpoint (MassTransit), but in ServiceCollectionExtensions.cs Main API old email logic is removed without adding MassTransit. When running there will be a DI exception — IPublishEndpoint is not registered.

  2. CI — 0% coverage, 6.3% duplication
    build.yml is not updated for new Streetcode.Email.* projects — tests do not run in CI.

  3. Down() migration — bug

// First renames: Emails → Feedbacks, Content → Message
// Then references old names:
migrationBuilder.AlterColumn(name: "Content", table: "Emails", ...);
// Should be: name: "Message", table: "Feedbacks"
5. RabbitMQ host hardcoded

cfg.Host("localhost", "/"); // will not work in container/deploy
Need to read from configuration.

  1. EmailService.SendEmailAsync without try-catch — SMTP operations without error handling. Hangfire job will silently fail.

  2. Duplicate Hangfire dashboard

if (app.Environment.EnvironmentName == "Local")
app.UseHangfireDashboard("/dash"); // once
// ...
app.UseHangfireDashboard("/dash"); // once — always executed
Dashboard is open to all environments.

  1. Content MaxLength mismatch — Validator: MaximumLength(100), Entity: [MaxLength(1000)], DB: maxLength: 1000. Validator truncates to 100 characters, although the database allows 1000.

  2. Incomplete rename Feedback → Email:

Variable feedbackEntity in SendEmailHandler
Test namespace: Streetcode.Email.XUnitTest.MediatR.Feedback
Test names: ShouldReturnError_IfFeedbackIsNull, Handle_ShouldReturnOk_WhenFeedbackIsSavedSuccessfully
10. EF Core version mismatch — test project uses InMemory 9.0.13, DAL — EF Core 8.0.23. Major version mismatch.

@Darsicl
Copy link
Copy Markdown
Contributor Author

Darsicl commented Mar 2, 2026

All problems was fixed

Sohatzk
Sohatzk previously approved these changes Mar 2, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 2, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
8.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copy link
Copy Markdown
Contributor

@Serpantyn Serpantyn left a comment

Choose a reason for hiding this comment

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

approved

Copy link
Copy Markdown
Contributor

@DrFaust555 DrFaust555 left a comment

Choose a reason for hiding this comment

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

Add changes from PR #120 (Test Email API step in build.yml) directly to this PR, because now they block each other — this PR fails without a test step in CI, and PR #120 fails because the project is not yet on dev. After that, close PR #120 as unnecessary. The rest of the comments are fixed, after adding build.yml you can merge.

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

Labels

task Regular task

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants