Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7d4c7fb
feat: implement Catalogs module with complete CRUD operations
Nov 18, 2025
d56dbab
Merge master into catalogs_module_implementation
Nov 18, 2025
3266102
remove arquivo desnecessario
Nov 18, 2025
1498f4f
fix: correct test data for Catalogs module requests
Nov 18, 2025
914fc23
fix(catalogs): correct authorization and API response format
Nov 18, 2025
859bbe3
refactor(catalogs): improve API consistency and service name validation
Nov 18, 2025
2cef125
refactor(catalogs): code quality improvements and test infrastructure…
Nov 18, 2025
c163a94
refactor(catalogs): apply code review suggestions for test quality
Nov 18, 2025
9632cbc
refactor(catalogs): apply comprehensive code review suggestions
Nov 18, 2025
7bf80df
docs: remove redundant README_TESTS.md from Catalogs module
Nov 18, 2025
7d2a9b4
fix(catalogs): improve test assertions and repository name normalization
Nov 18, 2025
db3ee27
refactor(catalogs): apply code review round 6 - consistency and robus…
Nov 18, 2025
73658d7
refactor(catalogs): apply code review round 7 - validation, diagnosti…
Nov 18, 2025
89bd2a8
refactor(catalogs): add input validation guards and batch query optim…
Nov 18, 2025
87f6d1f
test(catalogs): improve domain test coverage and robustness
Nov 18, 2025
ff80800
refactor(catalogs): fix validation, routing, and E2E test DTOs
Nov 18, 2025
bdf8248
chore: ignore launchSettings.json and fix empty GUID validation
Nov 18, 2025
840219d
refactor: improve code structure and standardization
Nov 18, 2025
af69fab
refactor: reorganize Catalogs handlers to match Users module structure
Nov 18, 2025
91d7803
docs: atualizar documentação dos módulos Catalogs e Location
Nov 18, 2025
bff62bd
style: aplicar dotnet format e corrigir imports dos Commands
Nov 19, 2025
60f3532
fix: adicionar validações Guid.Empty e corrigir documentação/testes
Nov 19, 2025
3fb3473
mais review
Nov 19, 2025
704c688
niitpicksom
Nov 19, 2025
2c26120
refactor: improve repository consistency and builder pattern
Nov 19, 2025
e51cb44
refactor: improve markdown formatting and test assertions
Nov 19, 2025
ccc633a
refactor: use nullable int for ServiceBuilder._displayOrder
Nov 19, 2025
943cfc0
refactor: add defensive length limits and improve test coverage
Nov 19, 2025
8cc6d40
style: fix whitespace formatting issues
Nov 19, 2025
231c608
test: strengthen E2E test assertions and improve determinism
Nov 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
style: aplicar dotnet format e corrigir imports dos Commands
- Corrigir usings em CatalogsDependencyInjectionTest.cs para incluir namespaces corretos
- Adicionar using para Commands.Service e Commands.ServiceCategory
- Corrigir referência para CreateServiceCategoryCommand assembly
- Aplicar formatação automática (whitespace, imports ordering) em 114 arquivos
- Build passa com sucesso, dotnet format --verify-no-changes limpo
  • Loading branch information
Filipe Frigini committed Nov 19, 2025
commit bff62bd5a4625b6ec6bad3b9a82c81127a0b641c
2 changes: 1 addition & 1 deletion src/Modules/Catalogs/API/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private static void EnsureDatabaseMigrations(WebApplication app)
{
using var scope = app.Services.CreateScope();
var logger = scope.ServiceProvider.GetService<ILogger<Infrastructure.Persistence.CatalogsDbContext>>();

// Only fallback to EnsureCreated in Development
if (app.Environment.IsDevelopment())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public async Task<Result<ServiceCategoryDto>> HandleAsync(CreateServiceCategoryC
return Result<ServiceCategoryDto>.Failure($"A category with name '{request.Name}' already exists.");

var category = ServiceCategory.Create(request.Name, request.Description, request.DisplayOrder);

await categoryRepository.AddAsync(category, cancellationToken);

var dto = new ServiceCategoryDto(
Expand All @@ -47,7 +47,8 @@ public async Task<Result<ServiceCategoryDto>> HandleAsync(CreateServiceCategoryC
return Result<ServiceCategoryDto>.Failure(ex.Message);
}
}
}public sealed class UpdateServiceCategoryCommandHandler(
}
public sealed class UpdateServiceCategoryCommandHandler(
IServiceCategoryRepository categoryRepository)
: ICommandHandler<UpdateServiceCategoryCommand, Result>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public async Task DeleteAsync(ServiceCategoryId id, CancellationToken cancellati
// For delete, we need to track the entity, so don't use AsNoTracking
var category = await context.ServiceCategories
.FirstOrDefaultAsync(c => c.Id == id, cancellationToken);

if (category is not null)
{
context.ServiceCategories.Remove(category);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public async Task DeleteAsync(ServiceId id, CancellationToken cancellationToken
// Use lightweight lookup without includes for delete
var service = await context.Services
.FirstOrDefaultAsync(s => s.Id == id, cancellationToken);

if (service is not null)
{
context.Services.Remove(service);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public async Task ServicesModule_Can_Validate_Services_From_Catalogs()
result.TryGetProperty("data", out var data).Should().BeTrue();
data.TryGetProperty("allValid", out var allValid).Should().BeTrue();
allValid.GetBoolean().Should().BeTrue();

data.TryGetProperty("invalidServiceIds", out var invalidIds).Should().BeTrue();
invalidIds.GetArrayLength().Should().Be(0);

data.TryGetProperty("inactiveServiceIds", out var inactiveIds).Should().BeTrue();
inactiveIds.GetArrayLength().Should().Be(0);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System.Text.Json;
using MeAjudaAi.E2E.Tests.Base;
using MeAjudaAi.Modules.Catalogs.Domain.Entities;
using MeAjudaAi.Modules.Catalogs.Domain.ValueObjects;
using MeAjudaAi.Modules.Catalogs.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using System.Text.Json;

namespace MeAjudaAi.E2E.Tests.Modules.Catalogs;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using FluentAssertions;
using MeAjudaAi.Integration.Tests.Base;
using MeAjudaAi.Modules.Catalogs.Application.Commands;
using MeAjudaAi.Modules.Catalogs.Application.Commands.Service;
using MeAjudaAi.Modules.Catalogs.Application.Commands.ServiceCategory;
using MeAjudaAi.Modules.Catalogs.Application.DTOs;
using MeAjudaAi.Shared.Commands;
using MeAjudaAi.Shared.Functional;
Expand Down Expand Up @@ -66,14 +67,14 @@ public void Should_Have_CatalogsDbContext_Registered()
public void Should_List_All_Registered_CommandHandlers()
{
// Arrange - Scan Catalogs assembly for command handler types
var catalogsAssembly = typeof(MeAjudaAi.Modules.Catalogs.Application.Commands.CreateServiceCategoryCommand).Assembly;
var catalogsAssembly = typeof(CreateServiceCategoryCommand).Assembly;
var commandHandlerType = typeof(ICommandHandler<,>);

// Act - Find all types that implement ICommandHandler<,>
var handlerTypes = catalogsAssembly.GetTypes()
.Where(t => t.IsClass && !t.IsAbstract)
.Where(t => t.GetInterfaces().Any(i =>
i.IsGenericType &&
.Where(t => t.GetInterfaces().Any(i =>
i.IsGenericType &&
i.GetGenericTypeDefinition() == commandHandlerType))
.ToList();

Expand Down Expand Up @@ -123,7 +124,7 @@ public async Task Should_Be_Able_To_Resolve_And_Execute_CreateServiceCategoryCom
testOutput.WriteLine($"Exception: {ex.GetType().Name}");
testOutput.WriteLine($"Message: {ex.Message}");
testOutput.WriteLine($"StackTrace: {ex.StackTrace}");

if (ex.InnerException != null)
{
testOutput.WriteLine($"InnerException: {ex.InnerException.GetType().Name}");
Expand All @@ -136,7 +137,7 @@ public async Task Should_Be_Able_To_Resolve_And_Execute_CreateServiceCategoryCom
testOutput.WriteLine($"Result IsSuccess: {result?.IsSuccess}");
testOutput.WriteLine($"Result Value: {result?.Value}");
testOutput.WriteLine($"Result Error: {result?.Error}");

exception.Should().BeNull("Command execution should not throw exception");
result.Should().NotBeNull("Command should return a result");
result.IsSuccess.Should().BeTrue("Command should succeed");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using FluentAssertions;
using MeAjudaAi.Integration.Tests.Base;
using System.Net;
using System.Net.Http.Json;
using System.Text.Json;
using FluentAssertions;
using MeAjudaAi.Integration.Tests.Base;

namespace MeAjudaAi.Integration.Tests.Modules.Catalogs;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using FluentAssertions;
using MeAjudaAi.Integration.Tests.Base;
using System.Net;
using System.Net.Http.Json;
using System.Text.Json;
using FluentAssertions;
using MeAjudaAi.Integration.Tests.Base;

namespace MeAjudaAi.Integration.Tests.Modules.Catalogs;

Expand Down Expand Up @@ -37,18 +37,18 @@ public async Task Debug_CreateServiceCategory_ResponseFormat()
// Use shared JSON deserialization for consistency
var dto = await ReadJsonAsync<dynamic>(response.Content);
testOutput.WriteLine($"Deserialized DTO: {dto}");

var json = JsonSerializer.Deserialize<JsonElement>(content);
testOutput.WriteLine($"JSON ValueKind: {json.ValueKind}");

if (json.ValueKind == JsonValueKind.Object)
{
testOutput.WriteLine("Properties:");
foreach (var prop in json.EnumerateObject())
{
testOutput.WriteLine($" {prop.Name}: {prop.Value.ValueKind} = {prop.Value}");
}

// Validate expected DTO shape
json.TryGetProperty("id", out _).Should().BeTrue("DTO should have 'id' property");
json.TryGetProperty("name", out _).Should().BeTrue("DTO should have 'name' property");
Expand Down