feature: CMS Opus status surfaces — backfill missing-N badge + upload Post-Processing phase (18.6)
This commit is contained in:
@@ -804,6 +804,50 @@ public class CmsTrackService : ICmsTrackService
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ResultContainer<OpusStatusDto[]>> GetOpusStatusAsync(CancellationToken ct = default)
|
||||
{
|
||||
var client = _httpClientFactory.CreateClient(ContentCmsClientName);
|
||||
|
||||
HttpResponseMessage response;
|
||||
try
|
||||
{
|
||||
response = await client.GetAsync("api/track/opus-status", ct);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Content API call failed for Opus status");
|
||||
return ResultContainer<OpusStatusDto[]>.CreateFailResult("Content API is unreachable.");
|
||||
}
|
||||
|
||||
using (response)
|
||||
{
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
_logger.LogError("Content API Opus status failed: {Status}", (int)response.StatusCode);
|
||||
return ResultContainer<OpusStatusDto[]>.CreateFailResult("Failed to load Opus status.");
|
||||
}
|
||||
|
||||
OpusStatusDto[]? status;
|
||||
try
|
||||
{
|
||||
status = await response.Content.ReadFromJsonAsync<OpusStatusDto[]>(ct);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Failed to deserialize Opus status from Content API response");
|
||||
return ResultContainer<OpusStatusDto[]>.CreateFailResult("Content API returned an unexpected response.");
|
||||
}
|
||||
|
||||
if (status is null)
|
||||
{
|
||||
_logger.LogError("Content API returned a null Opus status list");
|
||||
return ResultContainer<OpusStatusDto[]>.CreateFailResult("Content API returned an empty response.");
|
||||
}
|
||||
|
||||
return ResultContainer<OpusStatusDto[]>.CreatePassResult(status);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ResultContainer<List<ReleaseDto>>> GetReleasesAsync(CancellationToken ct = default)
|
||||
{
|
||||
var client = _httpClientFactory.CreateClient(ContentCmsClientName);
|
||||
|
||||
Reference in New Issue
Block a user