refactor+feat(backend): ChargeableCharConfig por ProductType + Reactivate + Delete endpoints (PRC-001)

Part A — MedioId → ProductTypeId rename across all C# layers:
  Domain, Application, Infrastructure, API, all test projects.
  Solution was non-compilable after BD refactor (5c1675e); now compiles clean (0 errors).

Part B — PATCH /api/v1/admin/chargeable-chars/{id}/reactivate:
  ReactivateChargeableCharConfigCommand/Handler, SP guard maps 50410/50411/50412
  → ChargeableCharConfigReactivationNotAllowedException(Reason) → HTTP 409.

Part C — DELETE /api/v1/admin/chargeable-chars/{id}:
  DeleteChargeableCharConfigCommand/Handler, physical DELETE on SYSTEM_VERSIONED table.
  KeyNotFoundException → 404 via ExceptionFilter.

Tests: +30 unit tests (TDD RED→GREEN). All 1266 unit tests pass.
This commit is contained in:
2026-04-21 10:54:47 -03:00
parent 5c1675e59a
commit f7fb76219a
35 changed files with 1273 additions and 273 deletions

View File

@@ -95,15 +95,15 @@ public sealed class ChargeableCharConfigTests
entity.Category.Should().Be("Currency");
entity.PricePerUnit.Should().Be(1.5m);
entity.ValidFrom.Should().Be(Today);
entity.MedioId.Should().BeNull();
entity.ProductTypeId.Should().BeNull();
}
[Fact]
public void Create_WithMedioId_SetsCorrectly()
public void Create_WithProductTypeId_SetsCorrectly()
{
var entity = ChargeableCharConfig.Create(5, "$", "Currency", 2.0m, Today);
entity.MedioId.Should().Be(5);
entity.ProductTypeId.Should().Be(5);
}
[Fact]
@@ -218,11 +218,11 @@ public sealed class ChargeableCharConfigTests
{
// Rehydrate can create entities that would fail Create (e.g., IsActive=false)
var entity = ChargeableCharConfig.Rehydrate(
id: 42, medioId: 5, symbol: "$", category: "Currency",
id: 42, productTypeId: 5, symbol: "$", category: "Currency",
price: 1.5m, validFrom: Today, validTo: Today.AddDays(30), isActive: false);
entity.Id.Should().Be(42);
entity.MedioId.Should().Be(5);
entity.ProductTypeId.Should().Be(5);
entity.Symbol.Should().Be("$");
entity.Category.Should().Be("Currency");
entity.PricePerUnit.Should().Be(1.5m);