diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..64cbc39
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,83 @@
+root = true
+
+[*]
+indent_style = space
+indent_size = 4
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.{csproj,props,targets,config,nuspec,xml}]
+indent_size = 2
+
+[*.{json,yml,yaml}]
+indent_size = 2
+
+[*.sln]
+indent_style = tab
+
+[*.md]
+trim_trailing_whitespace = false
+
+[*.cs]
+# Sort using and Import directives with System.* appearing first
+dotnet_sort_system_directives_first = true
+
+# Use language keywords instead of framework type names for type references
+dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
+dotnet_style_predefined_type_for_member_access = true:suggestion
+
+# Suggest more modern language features when available
+dotnet_style_object_initializer = true:suggestion
+dotnet_style_collection_initializer = true:suggestion
+dotnet_style_explicit_tuple_names = true:suggestion
+dotnet_style_null_propagation = true:suggestion
+dotnet_style_coalesce_expression = true:suggestion
+
+# Namespace preferences
+csharp_style_namespace_declarations = file_scoped:suggestion
+
+# var preferences
+csharp_style_var_for_built_in_types = false:none
+csharp_style_var_when_type_is_apparent = true:suggestion
+csharp_style_var_elsewhere = false:none
+
+# Expression-bodied members
+csharp_style_expression_bodied_methods = false:none
+csharp_style_expression_bodied_constructors = false:none
+csharp_style_expression_bodied_properties = true:suggestion
+csharp_style_expression_bodied_indexers = true:suggestion
+csharp_style_expression_bodied_accessors = true:suggestion
+
+# Pattern matching preferences
+csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
+csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
+
+# Null-checking preferences
+csharp_style_throw_expression = true:suggestion
+csharp_style_conditional_delegate_call = true:suggestion
+
+# Modifier preferences
+dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
+
+# Expression-level preferences
+dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
+dotnet_style_prefer_compound_assignment = true:suggestion
+dotnet_style_prefer_conditional_expression_over_assignment = true:none
+dotnet_style_prefer_conditional_expression_over_return = true:none
+
+# Code block preferences
+csharp_prefer_braces = true:suggestion
+csharp_prefer_simple_using_statement = true:suggestion
+
+# Naming conventions
+dotnet_naming_rule.private_fields_should_be_camel_case.severity = suggestion
+dotnet_naming_rule.private_fields_should_be_camel_case.symbols = private_fields
+dotnet_naming_rule.private_fields_should_be_camel_case.style = camel_case_underscore
+
+dotnet_naming_symbols.private_fields.applicable_kinds = field
+dotnet_naming_symbols.private_fields.applicable_accessibilities = private
+
+dotnet_naming_style.camel_case_underscore.required_prefix = _
+dotnet_naming_style.camel_case_underscore.capitalization = camel_case
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 80b6436..c1ba036 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -2,9 +2,9 @@ name: .NET CI
on:
push:
- branches: [ main, develop ]
+ branches: [ master, develop ]
pull_request:
- branches: [ main, develop ]
+ branches: [ master, develop ]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
diff --git a/ClientManager.sln b/ClientManager.sln
index 185fa5b..5d555f3 100644
--- a/ClientManager.sln
+++ b/ClientManager.sln
@@ -29,8 +29,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientManager.Infrastructure.Messaging", "src\ClientManager.Infrastructure.Messaging\ClientManager.Infrastructure.Messaging.csproj", "{07AF7C49-BC46-4B46-8C0F-209B11E3E219}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientManager.Worker", "src\ClientManager.Worker\ClientManager.Worker.csproj", "{77C2F93F-E434-43B2-8979-0CFC0509F522}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -173,18 +171,6 @@ Global
{07AF7C49-BC46-4B46-8C0F-209B11E3E219}.Release|x64.Build.0 = Release|Any CPU
{07AF7C49-BC46-4B46-8C0F-209B11E3E219}.Release|x86.ActiveCfg = Release|Any CPU
{07AF7C49-BC46-4B46-8C0F-209B11E3E219}.Release|x86.Build.0 = Release|Any CPU
- {77C2F93F-E434-43B2-8979-0CFC0509F522}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {77C2F93F-E434-43B2-8979-0CFC0509F522}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {77C2F93F-E434-43B2-8979-0CFC0509F522}.Debug|x64.ActiveCfg = Debug|Any CPU
- {77C2F93F-E434-43B2-8979-0CFC0509F522}.Debug|x64.Build.0 = Debug|Any CPU
- {77C2F93F-E434-43B2-8979-0CFC0509F522}.Debug|x86.ActiveCfg = Debug|Any CPU
- {77C2F93F-E434-43B2-8979-0CFC0509F522}.Debug|x86.Build.0 = Debug|Any CPU
- {77C2F93F-E434-43B2-8979-0CFC0509F522}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {77C2F93F-E434-43B2-8979-0CFC0509F522}.Release|Any CPU.Build.0 = Release|Any CPU
- {77C2F93F-E434-43B2-8979-0CFC0509F522}.Release|x64.ActiveCfg = Release|Any CPU
- {77C2F93F-E434-43B2-8979-0CFC0509F522}.Release|x64.Build.0 = Release|Any CPU
- {77C2F93F-E434-43B2-8979-0CFC0509F522}.Release|x86.ActiveCfg = Release|Any CPU
- {77C2F93F-E434-43B2-8979-0CFC0509F522}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -195,7 +181,6 @@ Global
{98846CF7-5D38-4F51-B716-5CEC4C79C3F3} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
{A88C2EB6-8A7B-4B04-A94E-44E91429F604} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
{07AF7C49-BC46-4B46-8C0F-209B11E3E219} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
- {77C2F93F-E434-43B2-8979-0CFC0509F522} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {367C61BC-A677-42E5-B2AD-79754550DF13}
diff --git a/Directory.Build.props b/Directory.Build.props
new file mode 100644
index 0000000..730cd24
--- /dev/null
+++ b/Directory.Build.props
@@ -0,0 +1,20 @@
+
+
+
+ net9.0
+ enable
+ enable
+ true
+ true
+ latest-recommended
+ CA1848;CA1816;CA1000
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
diff --git a/src/ClientManager.Api/ClientManager.Api.csproj b/src/ClientManager.Api/ClientManager.Api.csproj
index 58e2fef..82e80f4 100644
--- a/src/ClientManager.Api/ClientManager.Api.csproj
+++ b/src/ClientManager.Api/ClientManager.Api.csproj
@@ -1,9 +1,6 @@
- net9.0
- enable
- enable
true
$(NoWarn);1591
@@ -21,6 +18,4 @@
-
-
diff --git a/src/ClientManager.Application/AuthApplication.cs b/src/ClientManager.Application/AuthApplication.cs
index fb0d59d..b73cd36 100644
--- a/src/ClientManager.Application/AuthApplication.cs
+++ b/src/ClientManager.Application/AuthApplication.cs
@@ -1,4 +1,5 @@
using ClientManager.Application.Mappers;
+using ClientManager.Domain.Core.Interfaces.Services;
using ClientManager.Domain.Core.Responses;
using FluentValidation;
@@ -8,6 +9,7 @@ public class AuthApplication : IAuthApplication
{
private readonly IUserService _userService;
private readonly ITokenService _tokenService;
+ private readonly IEmailService _emailService;
private readonly IValidator _createUserValidator;
private readonly IValidator _loginValidator;
@@ -17,11 +19,13 @@ public class AuthApplication : IAuthApplication
public AuthApplication(
IUserService userService,
ITokenService tokenService,
+ IEmailService emailService,
IValidator createUserValidator,
IValidator loginValidator)
{
_userService = userService;
_tokenService = tokenService;
+ _emailService = emailService;
_createUserValidator = createUserValidator;
_loginValidator = loginValidator;
}
@@ -49,6 +53,18 @@ public AuthApplication(
await _userService.AddUserAsync(user).ConfigureAwait(false);
+ _ = Task.Run(async () =>
+ {
+ try
+ {
+ await _emailService.SendWelcomeEmailAsync(user.Email, user.Username).ConfigureAwait(false);
+ }
+ catch
+ {
+ // fire-and-forget: email failure should not block registration
+ }
+ });
+
var token = _tokenService.GenerateToken(user.Id, user.Username, user.Email, user.Role);
var refreshToken = _tokenService.GenerateRefreshToken();
_refreshTokens[refreshToken] = user.Id;
diff --git a/src/ClientManager.Application/ClientManager.Application.csproj b/src/ClientManager.Application/ClientManager.Application.csproj
index f8c3f68..92b049f 100644
--- a/src/ClientManager.Application/ClientManager.Application.csproj
+++ b/src/ClientManager.Application/ClientManager.Application.csproj
@@ -1,11 +1,5 @@
-
- net9.0
- enable
- enable
-
-
@@ -23,4 +17,3 @@
-
diff --git a/src/ClientManager.Domain.Core/ClientManager.Domain.Core.csproj b/src/ClientManager.Domain.Core/ClientManager.Domain.Core.csproj
index e653fd5..daf06c3 100644
--- a/src/ClientManager.Domain.Core/ClientManager.Domain.Core.csproj
+++ b/src/ClientManager.Domain.Core/ClientManager.Domain.Core.csproj
@@ -1,11 +1,5 @@
-
- net9.0
- enable
- enable
-
-
@@ -17,4 +11,3 @@
-
diff --git a/src/ClientManager.Domain.Core/Helpers/DocumentHelper.cs b/src/ClientManager.Domain.Core/Helpers/DocumentHelper.cs
index d0b8869..e341578 100644
--- a/src/ClientManager.Domain.Core/Helpers/DocumentHelper.cs
+++ b/src/ClientManager.Domain.Core/Helpers/DocumentHelper.cs
@@ -1,3 +1,5 @@
+using System.Globalization;
+
namespace ClientManager.Domain.Core.Helpers
{
public static class DocumentHelper
@@ -42,7 +44,7 @@ private static bool HasValidCpfDigits(string cpf)
int[] multiplier2 = { 11, 10, 9, 8, 7, 6, 5, 4, 3, 2 };
for (int i = 0; i < 9; i++)
- sum += int.Parse(tempCpf[i].ToString()) * multiplier1[i];
+ sum += int.Parse(tempCpf[i].ToString(), CultureInfo.InvariantCulture) * multiplier1[i];
var remainder = sum % 11;
var digit1 = remainder < 2 ? 0 : 11 - remainder;
@@ -51,12 +53,12 @@ private static bool HasValidCpfDigits(string cpf)
sum = 0;
for (int i = 0; i < 10; i++)
- sum += int.Parse(tempCpf[i].ToString()) * multiplier2[i];
+ sum += int.Parse(tempCpf[i].ToString(), CultureInfo.InvariantCulture) * multiplier2[i];
remainder = sum % 11;
var digit2 = remainder < 2 ? 0 : 11 - remainder;
- return cpf.EndsWith(digit1.ToString() + digit2.ToString());
+ return cpf.EndsWith(digit1.ToString(CultureInfo.InvariantCulture) + digit2.ToString(CultureInfo.InvariantCulture), StringComparison.Ordinal);
}
private static bool HasValidCnpjDigits(string cnpj)
@@ -68,7 +70,7 @@ private static bool HasValidCnpjDigits(string cnpj)
var sum = 0;
for (int i = 0; i < 12; i++)
- sum += int.Parse(tempCnpj[i].ToString()) * multiplier1[i];
+ sum += int.Parse(tempCnpj[i].ToString(), CultureInfo.InvariantCulture) * multiplier1[i];
var remainder = (sum % 11);
var digit1 = remainder < 2 ? 0 : 11 - remainder;
@@ -77,12 +79,12 @@ private static bool HasValidCnpjDigits(string cnpj)
sum = 0;
for (int i = 0; i < 13; i++)
- sum += int.Parse(tempCnpj[i].ToString()) * multiplier2[i];
+ sum += int.Parse(tempCnpj[i].ToString(), CultureInfo.InvariantCulture) * multiplier2[i];
remainder = (sum % 11);
var digit2 = remainder < 2 ? 0 : 11 - remainder;
- return cnpj.EndsWith(digit1.ToString() + digit2.ToString());
+ return cnpj.EndsWith(digit1.ToString(CultureInfo.InvariantCulture) + digit2.ToString(CultureInfo.InvariantCulture), StringComparison.Ordinal);
}
}
}
diff --git a/src/ClientManager.Domain.Services/ClientManager.Domain.Services.csproj b/src/ClientManager.Domain.Services/ClientManager.Domain.Services.csproj
index a392fd9..415030b 100644
--- a/src/ClientManager.Domain.Services/ClientManager.Domain.Services.csproj
+++ b/src/ClientManager.Domain.Services/ClientManager.Domain.Services.csproj
@@ -1,11 +1,5 @@
-
- net9.0
- enable
- enable
-
-
@@ -15,4 +9,3 @@
-
diff --git a/src/ClientManager.Domain/ClientManager.Domain.csproj b/src/ClientManager.Domain/ClientManager.Domain.csproj
index 755f5e0..73e81f7 100644
--- a/src/ClientManager.Domain/ClientManager.Domain.csproj
+++ b/src/ClientManager.Domain/ClientManager.Domain.csproj
@@ -1,11 +1,5 @@
-
- net9.0
- enable
- enable
-
-
@@ -15,4 +9,3 @@
-
diff --git a/src/ClientManager.Domain/Model/Customer.cs b/src/ClientManager.Domain/Model/Customer.cs
index 49b641f..057615a 100644
--- a/src/ClientManager.Domain/Model/Customer.cs
+++ b/src/ClientManager.Domain/Model/Customer.cs
@@ -46,7 +46,7 @@ public void UpdateDetails(string name, string email, string document, Address? a
Address = address;
}
- private string CleanDocument(string document)
+ private static string CleanDocument(string document)
{
if (string.IsNullOrWhiteSpace(document)) return string.Empty;
return new string(document.Where(c => char.IsDigit(c)).ToArray());
@@ -59,7 +59,7 @@ public void EvaluateVerificationStatus(IEnumerable documents)
var docsList = documents?.ToList() ?? new List();
// Se não tem nenhum documento, volta/mantém como Pendente
- if (!docsList.Any())
+ if (docsList.Count == 0)
{
SetPending();
return;
diff --git a/src/ClientManager.Infrastructure.Messaging/ClientManager.Infrastructure.Messaging.csproj b/src/ClientManager.Infrastructure.Messaging/ClientManager.Infrastructure.Messaging.csproj
index d3c286c..e20f7e2 100644
--- a/src/ClientManager.Infrastructure.Messaging/ClientManager.Infrastructure.Messaging.csproj
+++ b/src/ClientManager.Infrastructure.Messaging/ClientManager.Infrastructure.Messaging.csproj
@@ -1,10 +1,4 @@
-
-
-
- net9.0
- enable
- enable
-
+
diff --git a/src/ClientManager.Infrastructure/ClientManager.Infrastructure.csproj b/src/ClientManager.Infrastructure/ClientManager.Infrastructure.csproj
index 97180c0..62b7ea6 100644
--- a/src/ClientManager.Infrastructure/ClientManager.Infrastructure.csproj
+++ b/src/ClientManager.Infrastructure/ClientManager.Infrastructure.csproj
@@ -1,11 +1,5 @@
-
- net9.0
- enable
- enable
-
-
@@ -26,4 +20,3 @@
-
diff --git a/src/ClientManager.Infrastructure/Services/SmtpEmailService.cs b/src/ClientManager.Infrastructure/Services/SmtpEmailService.cs
index 1d08a9d..c2a6c08 100644
--- a/src/ClientManager.Infrastructure/Services/SmtpEmailService.cs
+++ b/src/ClientManager.Infrastructure/Services/SmtpEmailService.cs
@@ -1,3 +1,4 @@
+using System.Globalization;
using System.Net;
using System.Net.Mail;
using ClientManager.Domain.Core.Interfaces.Services;
@@ -11,7 +12,7 @@ public class SmtpEmailService(IConfiguration configuration, ILogger
-
-
- net9.0
- enable
- enable
- dotnet-ClientManager.Worker-8a5f3cfe-c9bb-47f1-bbfc-649472cf5986
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/ClientManager.Worker/Consumers/CustomerCreatedConsumer.cs b/src/ClientManager.Worker/Consumers/CustomerCreatedConsumer.cs
deleted file mode 100644
index 49802a6..0000000
--- a/src/ClientManager.Worker/Consumers/CustomerCreatedConsumer.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using ClientManager.Domain.Core.Events;
-using ClientManager.Domain.Core.Interfaces.Services;
-using Microsoft.Extensions.Logging;
-
-namespace ClientManager.Worker.Consumers;
-
-public class CustomerCreatedConsumer(
- IEmailService emailService,
- IPdfGenerator pdfGenerator,
- ILogger logger)
-{
- public async Task HandleAsync(CustomerCreatedEvent @event)
- {
- logger.LogInformation("Processing customer creation for: {Name} ({Email})", @event.Name, @event.Email);
-
- try
- {
- // 1. Generate Welcome Kit PDF first
- var pdfBytes = await pdfGenerator.GenerateWelcomeKitAsync(@event.CustomerId, @event.Name);
- var attachmentName = $"WelcomeKit_{@event.Name.Replace(" ", "_")}.pdf";
- logger.LogInformation("Welcome kit PDF generated ({Size} bytes) for {CustomerId}", pdfBytes.Length, @event.CustomerId);
-
- // 2. Send Welcome Email with PDF attachment
- await emailService.SendWelcomeEmailAsync(@event.Email, @event.Name, pdfBytes, attachmentName);
-
- logger.LogInformation("Welcome flow completed with attachment for customer {CustomerId}", @event.CustomerId);
- }
- catch (Exception ex)
- {
- logger.LogError(ex, "Error processing welcome flow for customer {CustomerId}", @event.CustomerId);
- throw; // RabbitMQ will retry based on configuration
- }
- }
-}
diff --git a/src/ClientManager.Worker/Consumers/DocumentUploadedConsumer.cs b/src/ClientManager.Worker/Consumers/DocumentUploadedConsumer.cs
deleted file mode 100644
index 6bf6526..0000000
--- a/src/ClientManager.Worker/Consumers/DocumentUploadedConsumer.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-using ClientManager.Domain.Core.Events;
-using ClientManager.Domain.Core.Interfaces.Services;
-using ClientManager.Domain.Enums;
-using Microsoft.Extensions.Logging;
-
-namespace ClientManager.Worker.Consumers;
-
-public class DocumentUploadedConsumer(
- IDocumentService documentService,
- ICustomerService customerService,
- ILogger logger)
-{
- public async Task HandleAsync(DocumentUploadedEvent @event)
- {
- logger.LogInformation("Processing document: {DocumentId} ({FileName}) for customer {CustomerId}",
- @event.DocumentId, @event.FileName, @event.CustomerId);
-
- try
- {
- var document = await documentService.GetDocumentByIdAsync(@event.DocumentId);
- if (document == null)
- {
- logger.LogWarning("Document {DocumentId} not found", @event.DocumentId);
- return;
- }
-
- // 1. File Integrity Check (Simulated)
- await Task.Delay(1000);
- if (@event.FileName.EndsWith(".exe") || @event.FileName.EndsWith(".bat"))
- {
- document.Reject("File integrity check failed: Potentially dangerous file type.");
- await documentService.UpdateDocumentAsync(document);
- logger.LogWarning("Document {DocumentId} rejected due to file type", @event.DocumentId);
- return;
- }
-
- // 2. OCR Processing (Simulated)
- logger.LogInformation("Running OCR for document {DocumentId}...", @event.DocumentId);
- await Task.Delay(3000);
-
- // Simulation logic: if filename has "invalid" or "error", fail OCR
- if (@event.FileName.Contains("invalid", StringComparison.OrdinalIgnoreCase) ||
- @event.FileName.Contains("error", StringComparison.OrdinalIgnoreCase))
- {
- document.Reject("OCR validation failed: Could not extract data from document image.");
- logger.LogInformation("Document {DocumentId} REJECTED by OCR", @event.DocumentId);
- }
- else
- {
- document.Verify();
- logger.LogInformation("Document {DocumentId} VERIFIED after OCR", @event.DocumentId);
- }
-
- await documentService.UpdateDocumentAsync(document);
-
- // 3. Re-evaluate customer status
- var customer = await customerService.GetCustomerByIdAsync(@event.CustomerId);
- if (customer != null)
- {
- var documents = await documentService.GetDocumentsByCustomerIdAsync(@event.CustomerId);
- customer.EvaluateVerificationStatus(documents);
- await customerService.UpdateCustomerAsync(customer);
-
- logger.LogInformation("Customer {CustomerId} status updated to {Status}",
- customer.Id, customer.Status);
- }
- }
- catch (Exception ex)
- {
- logger.LogError(ex, "Error processing document {DocumentId}", @event.DocumentId);
- throw;
- }
- }
-}
diff --git a/src/ClientManager.Worker/Dockerfile b/src/ClientManager.Worker/Dockerfile
deleted file mode 100644
index 0660515..0000000
--- a/src/ClientManager.Worker/Dockerfile
+++ /dev/null
@@ -1,26 +0,0 @@
-# Stage 1: Build
-FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
-WORKDIR /src
-
-# Copy all project files to restore dependencies
-COPY ["src/ClientManager.Worker/ClientManager.Worker.csproj", "src/ClientManager.Worker/"]
-COPY ["src/ClientManager.Application/ClientManager.Application.csproj", "src/ClientManager.Application/"]
-COPY ["src/ClientManager.Domain/ClientManager.Domain.csproj", "src/ClientManager.Domain/"]
-COPY ["src/ClientManager.Domain.Core/ClientManager.Domain.Core.csproj", "src/ClientManager.Domain.Core/"]
-COPY ["src/ClientManager.Domain.Services/ClientManager.Domain.Services.csproj", "src/ClientManager.Domain.Services/"]
-COPY ["src/ClientManager.Infrastructure/ClientManager.Infrastructure.csproj", "src/ClientManager.Infrastructure/"]
-COPY ["src/ClientManager.Infrastructure.Messaging/ClientManager.Infrastructure.Messaging.csproj", "src/ClientManager.Infrastructure.Messaging/"]
-
-RUN dotnet restore "src/ClientManager.Worker/ClientManager.Worker.csproj"
-
-# Copy the rest of the code and build
-COPY . .
-WORKDIR "/src/src/ClientManager.Worker"
-RUN dotnet publish "ClientManager.Worker.csproj" -c Release -o /app/publish /p:UseAppHost=false
-
-# Stage 2: Final (Runtime)
-FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS final
-WORKDIR /app
-COPY --from=build /app/publish .
-
-ENTRYPOINT ["dotnet", "ClientManager.Worker.dll"]
diff --git a/src/ClientManager.Worker/Program.cs b/src/ClientManager.Worker/Program.cs
deleted file mode 100644
index b705bb9..0000000
--- a/src/ClientManager.Worker/Program.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using ClientManager.Infrastructure.CrossCutting.Ioc;
-using ClientManager.Infrastructure.Messaging.DependencyInjection;
-using ClientManager.Worker;
-using ClientManager.Worker.Consumers;
-
-var builder = Host.CreateApplicationBuilder(args);
-
-// Infrastructure
-builder.Services.AddRavenDb(builder.Configuration);
-builder.Services.AddRepositories();
-
-// Domain Services
-builder.Services.AddDomainServices();
-
-// Infrastructure Services
-builder.Services.AddInfrastructureServices(builder.Configuration);
-
-// Messaging
-builder.Services.AddMessaging();
-
-// Consumers (Scoped as they depend on Scoped services)
-builder.Services.AddScoped();
-builder.Services.AddScoped();
-
-// Worker
-builder.Services.AddHostedService();
-
-var host = builder.Build();
-host.Run();
diff --git a/src/ClientManager.Worker/Properties/launchSettings.json b/src/ClientManager.Worker/Properties/launchSettings.json
deleted file mode 100644
index f90f5c5..0000000
--- a/src/ClientManager.Worker/Properties/launchSettings.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "$schema": "https://json.schemastore.org/launchsettings.json",
- "profiles": {
- "ClientManager.Worker": {
- "commandName": "Project",
- "dotnetRunMessages": true,
- "environmentVariables": {
- "DOTNET_ENVIRONMENT": "Development"
- }
- }
- }
-}
diff --git a/src/ClientManager.Worker/Worker.cs b/src/ClientManager.Worker/Worker.cs
deleted file mode 100644
index 7542e6c..0000000
--- a/src/ClientManager.Worker/Worker.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using ClientManager.Domain.Core.Events;
-using ClientManager.Domain.Core.Interfaces;
-using ClientManager.Worker.Consumers;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace ClientManager.Worker;
-
-public class Worker(
- ILogger logger,
- IMessageBus messageBus,
- IServiceScopeFactory scopeFactory) : BackgroundService
-{
- protected override async Task ExecuteAsync(CancellationToken stoppingToken)
- {
- logger.LogInformation("Worker starting and subscribing to queues...");
-
- await messageBus.SubscribeAsync("document-uploaded", async (@event) =>
- {
- using var scope = scopeFactory.CreateScope();
- var consumer = scope.ServiceProvider.GetRequiredService();
- await consumer.HandleAsync(@event);
- });
-
- await messageBus.SubscribeAsync("customer-created", async (@event) =>
- {
- using var scope = scopeFactory.CreateScope();
- var consumer = scope.ServiceProvider.GetRequiredService();
- await consumer.HandleAsync(@event);
- });
-
- while (!stoppingToken.IsCancellationRequested)
- {
- await Task.Delay(1000, stoppingToken);
- }
- }
-}
diff --git a/src/ClientManager.Worker/appsettings.Development.json b/src/ClientManager.Worker/appsettings.Development.json
deleted file mode 100644
index 766b77e..0000000
--- a/src/ClientManager.Worker/appsettings.Development.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "Logging": {
- "LogLevel": {
- "Default": "Information",
- "Microsoft.Hosting.Lifetime": "Information"
- }
- },
- "ConnectionStrings": {
- "RabbitMQ": "amqp://guest:guest@localhost:5672"
- },
- "Smtp": {
- "Host": "sandbox.smtp.mailtrap.io",
- "Port": "2525",
- "Username": "YOUR_MAILTRAP_USERNAME",
- "Password": "YOUR_MAILTRAP_PASSWORD",
- "FromEmail": "no-reply@clientmanager.com",
- "FromName": "ClientManager Local"
- },
- "RavenDbSettings": {
- "Url": "http://localhost:8080",
- "Database": "ClientManagementDB",
- "CertificatePath": "",
- "CertificatePassword": "",
- "CertificateBase64": ""
- }
-}
diff --git a/src/ClientManager.Worker/appsettings.json b/src/ClientManager.Worker/appsettings.json
deleted file mode 100644
index c0a254e..0000000
--- a/src/ClientManager.Worker/appsettings.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "Logging": {
- "LogLevel": {
- "Default": "Information",
- "Microsoft.Hosting.Lifetime": "Information"
- }
- },
- "ConnectionStrings": {
- "RabbitMQ": "amqps://user:password@hostname/vhost" // CloudAMQP URL here
- },
- "SendGrid": {
- "ApiKey": "YOUR_SENDGRID_API_KEY",
- "FromEmail": "no-reply@yourdomain.com",
- "FromName": "ClientManager"
- },
- "RavenDbSettings": {
- "Url": "RAVENDB_SETTINGS_URL",
- "Database": "RAVENDB_SETTINGS_DATABASE",
- "CertificatePath": "RAVENDB_SETTINGS_CERT_PATH",
- "CertificatePassword": "RAVENDB_SETTINGS_CERT_PASSWORD",
- "CertificateBase64": "RAVENDB_SETTINGS_CERT_BASE64"
- }
-}
diff --git a/tests/ClientManager.Api.Tests/ClientManager.Api.Tests.csproj b/tests/ClientManager.Api.Tests/ClientManager.Api.Tests.csproj
index aaf347c..285df63 100644
--- a/tests/ClientManager.Api.Tests/ClientManager.Api.Tests.csproj
+++ b/tests/ClientManager.Api.Tests/ClientManager.Api.Tests.csproj
@@ -1,67 +1,31 @@
-
-
-
- net9.0
-
- enable
-
- enable
-
false
-
true
-
-
-
-
-
-
-
-
runtime; build; native; contentfiles; analyzers; buildtransitive
-
all
-
-
-
runtime; build; native; contentfiles; analyzers; buildtransitive
-
all
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/ClientManager.Application.Tests/AuthApplicationTests.cs b/tests/ClientManager.Application.Tests/AuthApplicationTests.cs
index 70dc81d..79ff16f 100644
--- a/tests/ClientManager.Application.Tests/AuthApplicationTests.cs
+++ b/tests/ClientManager.Application.Tests/AuthApplicationTests.cs
@@ -14,6 +14,7 @@ public class AuthApplicationTests
{
private readonly Mock _userServiceMock;
private readonly Mock _tokenServiceMock;
+ private readonly Mock _emailServiceMock;
private readonly Mock> _createUserValidatorMock;
private readonly Mock> _loginValidatorMock;
private readonly AuthApplication _authApplication;
@@ -22,12 +23,14 @@ public AuthApplicationTests()
{
_userServiceMock = new Mock();
_tokenServiceMock = new Mock();
+ _emailServiceMock = new Mock();
_createUserValidatorMock = new Mock>();
_loginValidatorMock = new Mock>();
_authApplication = new AuthApplication(
_userServiceMock.Object,
_tokenServiceMock.Object,
+ _emailServiceMock.Object,
_createUserValidatorMock.Object,
_loginValidatorMock.Object
);
diff --git a/tests/ClientManager.Application.Tests/ClientManager.Application.Tests.csproj b/tests/ClientManager.Application.Tests/ClientManager.Application.Tests.csproj
index 5439cc0..458da51 100644
--- a/tests/ClientManager.Application.Tests/ClientManager.Application.Tests.csproj
+++ b/tests/ClientManager.Application.Tests/ClientManager.Application.Tests.csproj
@@ -1,9 +1,6 @@
- net9.0
- enable
- enable
false
true
diff --git a/tests/ClientManager.Domain.Services.Tests/ClientManager.Domain.Services.Tests.csproj b/tests/ClientManager.Domain.Services.Tests/ClientManager.Domain.Services.Tests.csproj
index ad53d82..ed1196a 100644
--- a/tests/ClientManager.Domain.Services.Tests/ClientManager.Domain.Services.Tests.csproj
+++ b/tests/ClientManager.Domain.Services.Tests/ClientManager.Domain.Services.Tests.csproj
@@ -1,9 +1,6 @@
- net9.0
- enable
- enable
false
true
diff --git a/tests/ClientManager.Domain.Tests/ClientManager.Domain.Tests.csproj b/tests/ClientManager.Domain.Tests/ClientManager.Domain.Tests.csproj
index f70ee73..e7f0747 100644
--- a/tests/ClientManager.Domain.Tests/ClientManager.Domain.Tests.csproj
+++ b/tests/ClientManager.Domain.Tests/ClientManager.Domain.Tests.csproj
@@ -1,9 +1,6 @@
- net9.0
- enable
- enable
false
true