feat(card-master): implement POST /immutable_data/card_master serving captured blob
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests.ImmutableData;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos.Responses.ImmutableData;
|
||||
using SVSim.EmulatedEntrypoint.Services;
|
||||
|
||||
namespace SVSim.EmulatedEntrypoint.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// Family <c>/immutable_data/*</c>. v1 hosts the single endpoint <c>card_master</c>;
|
||||
/// future siblings (e.g. mission masters, asset bundle hash tables) would land here.
|
||||
/// </summary>
|
||||
[Route("immutable_data")]
|
||||
public class ImmutableDataController : SVSimController
|
||||
{
|
||||
private readonly ICardMasterPayloadProvider _provider;
|
||||
|
||||
public ImmutableDataController(ICardMasterPayloadProvider provider)
|
||||
{
|
||||
_provider = provider;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the base64+gzip+json+csv card-master payload. Tier 1 serves a static prod
|
||||
/// snapshot regardless of the request's <c>card_master_hash</c>; freshness gating is
|
||||
/// handled on <c>/load/index</c> instead.
|
||||
/// </summary>
|
||||
[HttpPost("card_master")]
|
||||
public ActionResult<CardMasterResponse> CardMaster([FromBody] CardMasterRequest req)
|
||||
{
|
||||
if (!_provider.IsAvailable)
|
||||
{
|
||||
return StatusCode(503, "card-master payload not available");
|
||||
}
|
||||
return Ok(new CardMasterResponse { CardMaster = _provider.Base64Blob });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user