[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
@@ -1,9 +1,11 @@
using SatelliteProvider.Common.Enums;
namespace SatelliteProvider.Common.DTO;
public class RegionStatus
public class RegionStatusResponse
{
public Guid Id { get; set; }
public string Status { get; set; } = string.Empty;
public RegionStatus Status { get; set; }
public string? CsvFilePath { get; set; }
public string? SummaryFilePath { get; set; }
public int TilesDownloaded { get; set; }
@@ -11,4 +13,3 @@ public class RegionStatus
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}
@@ -1,12 +1,13 @@
using SatelliteProvider.Common.Enums;
namespace SatelliteProvider.Common.DTO;
public class RoutePointDto
{
public double Latitude { get; set; }
public double Longitude { get; set; }
public string PointType { get; set; } = string.Empty;
public RoutePointType PointType { get; set; }
public int SequenceNumber { get; set; }
public int SegmentIndex { get; set; }
public double? DistanceFromPrevious { get; set; }
}
@@ -0,0 +1,9 @@
namespace SatelliteProvider.Common.Enums;
public enum RegionStatus
{
Queued,
Processing,
Completed,
Failed,
}
@@ -0,0 +1,9 @@
namespace SatelliteProvider.Common.Enums;
public enum RoutePointType
{
Start,
End,
Action,
Intermediate,
}
@@ -4,8 +4,8 @@ namespace SatelliteProvider.Common.Interfaces;
public interface IRegionService
{
Task<RegionStatus> RequestRegionAsync(Guid id, double latitude, double longitude, double sizeMeters, int zoomLevel, bool stitchTiles = false);
Task<RegionStatus?> GetRegionStatusAsync(Guid id);
Task<RegionStatusResponse> RequestRegionAsync(Guid id, double latitude, double longitude, double sizeMeters, int zoomLevel, bool stitchTiles = false);
Task<RegionStatusResponse?> GetRegionStatusAsync(Guid id);
Task ProcessRegionAsync(Guid id, CancellationToken cancellationToken = default);
}