[AZ-370] Refactor C17: status / point-type enums + AC RT2 update

Replaces bare strings with two enums in Common/Enums/:
  RegionStatus { Queued, Processing, Completed, Failed }
  RoutePointType { Start, End, Action, Intermediate }

Adds a Dapper EnumStringTypeHandler<T> (DataAccess/TypeHandlers/)
that round-trips enums to/from lowercase strings, registered once
at startup via DapperEnumTypeHandlers.RegisterAll(). DataAccess now
references Common (project ref) so entities can carry the enum types.

Sites converted: RegionService (5), RouteProcessingService (3),
RoutePointGraphBuilder (4), entity Status/PointType columns. Log
message and summary file format preserved via .ToLowerInvariant().

API JSON contract preserved by adding JsonStringEnumConverter with
JsonNamingPolicy.CamelCase to the http JSON options — single-word
enum members serialize to the same lowercase strings as before.

DTO renamed: Common.DTO.RegionStatus -> RegionStatusResponse to
free the RegionStatus name for the new enum (forced by the task's
explicit enum name); the renamed DTO has no public-API impact at
the JSON wire level. Stale doc references updated.

AC RT2 in _docs/00_problem/acceptance_criteria.md now lists all 4
point types (start/end/action/intermediate).

Tests: 171 / 171 unit + 5 / 5 smoke green (was 141 + 5; +30 new tests
covering type handler round-trip, set/parse, unknown-value rejection,
idempotent registration, and the AC RT2 doc check).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-05-11 03:55:22 +03:00
parent 6d98c8f8d1
commit 23ab05766d
29 changed files with 357 additions and 84 deletions
@@ -2,6 +2,7 @@ using FluentAssertions;
using Microsoft.Extensions.Options;
using SatelliteProvider.Common.Configs;
using SatelliteProvider.Common.DTO;
using SatelliteProvider.Common.Enums;
using SatelliteProvider.Common.Utils;
using SatelliteProvider.Services.RouteManagement;
using SatelliteProvider.Tests.Fixtures;
@@ -26,10 +27,10 @@ public class RoutePointGraphBuilderTests
var graph = sut.Build(input);
graph.Points.First().PointType.Should().Be("start");
graph.Points.Last().PointType.Should().Be("end");
graph.Points.First().PointType.Should().Be(RoutePointType.Start);
graph.Points.Last().PointType.Should().Be(RoutePointType.End);
graph.Points.Skip(1).Take(graph.Points.Count - 2)
.Should().OnlyContain(p => p.PointType == "intermediate");
.Should().OnlyContain(p => p.PointType == RoutePointType.Intermediate);
}
[Fact]
@@ -60,10 +61,10 @@ public class RoutePointGraphBuilderTests
var graph = sut.Build(input);
graph.Points.Count(p => p.PointType == "start").Should().Be(1);
graph.Points.Count(p => p.PointType == "end").Should().Be(1);
graph.Points.Count(p => p.PointType == "action").Should().Be(8);
graph.Points.Should().Contain(p => p.PointType == "intermediate");
graph.Points.Count(p => p.PointType == RoutePointType.Start).Should().Be(1);
graph.Points.Count(p => p.PointType == RoutePointType.End).Should().Be(1);
graph.Points.Count(p => p.PointType == RoutePointType.Action).Should().Be(8);
graph.Points.Should().Contain(p => p.PointType == RoutePointType.Intermediate);
}
[Fact]