Fix the WIP health-check API slice to match established patterns:
- HealthController: add Name="GetHealthChecks" route name and move
[EndpointGroupName("general")] to method level, matching
FillerPresetController/FFmpegProfileController exactly (the
precedent for parameterless 200-only GET actions).
- HealthCheckResponseModel: enable #nullable for the file and mark
Link as string? since the mapper can emit null when
HealthCheckResult.Link is None.
- Mapper: fix a real bug - LanguageExt's Option.Match throws
ResultIsNullException.ResultIsNull if either branch returns null
(by design, to catch accidental nulls). The WIP's
`Link.Match(l => l.Link, () => null)` crashed on every health
check without a Link. Switch to MatchUnsafe, the LanguageExt-
sanctioned way to intentionally produce a nullable result from
Option<T>.
- HealthControllerTests: add the idiomatic-route-assertion test
(route template + Name) and empty-list case, matching
FillerPresetControllerTests.
Verified: GetAllHealthCheckResultsForApiHandler already matches the
existing GetAllHealthCheckResultsHandler's cancellation handling
(both swallow TaskCanceledException/OperationCanceledException), so
no change was needed there. Confirmed no OpenApi contract test
enumerates all endpoints for error-response metadata (it's an
explicit TestCase allowlist), so the new GET needed no new entries.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
9 lines
169 B
C#
9 lines
169 B
C#
#nullable enable
|
|
namespace ErsatzTV.Core.Api.Health;
|
|
|
|
public record HealthCheckResponseModel(
|
|
string Title,
|
|
string Status,
|
|
string Detail,
|
|
string? Link);
|