Review finding: NotApplicable is filtered by the handler before mapping, so a silent ->"info" arm would only mask a missing filter if the mapper is ever reused unfiltered. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
25 lines
780 B
C#
25 lines
780 B
C#
using ErsatzTV.Core.Api.Health;
|
|
using ErsatzTV.Core.Health;
|
|
|
|
namespace ErsatzTV.Application.Health;
|
|
|
|
internal static class Mapper
|
|
{
|
|
internal static HealthCheckResponseModel ProjectToResponseModel(HealthCheckResult result) =>
|
|
new(
|
|
result.Title,
|
|
GetStatus(result.Status),
|
|
result.Message,
|
|
result.Link.MatchUnsafe(l => l.Link, () => null));
|
|
|
|
private static string GetStatus(HealthCheckStatus status) =>
|
|
status switch
|
|
{
|
|
HealthCheckStatus.Pass => "pass",
|
|
HealthCheckStatus.Fail => "fail",
|
|
HealthCheckStatus.Warning => "warn",
|
|
HealthCheckStatus.Info => "info",
|
|
_ => throw new ArgumentOutOfRangeException(nameof(status), status, null)
|
|
};
|
|
}
|