37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
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 });
|
|
}
|
|
}
|