Also fixes BattlePassRepository.GetActiveSeasonAsync to use client-side DateTimeOffset filtering (SQLite provider cannot translate DateTimeOffset comparisons in LINQ WHERE/ORDER BY clauses).
32 lines
995 B
C#
32 lines
995 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using SVSim.EmulatedEntrypoint.Models.Dtos.BattlePass;
|
|
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;
|
|
using SVSim.EmulatedEntrypoint.Services;
|
|
|
|
namespace SVSim.EmulatedEntrypoint.Controllers;
|
|
|
|
/// <summary>
|
|
/// /battle_pass/* — season metadata, premium-pass purchase. Wire shapes mirror
|
|
/// Wizard/BattlePass{Info,PurchaseInfo,Buy}Task.cs.
|
|
/// </summary>
|
|
[Route("battle_pass")]
|
|
public class BattlePassController : SVSimController
|
|
{
|
|
private readonly IBattlePassService _battlePass;
|
|
|
|
public BattlePassController(IBattlePassService battlePass)
|
|
{
|
|
_battlePass = battlePass;
|
|
}
|
|
|
|
[HttpPost("info")]
|
|
public async Task<IActionResult> Info(BaseRequest request, CancellationToken ct)
|
|
{
|
|
if (!TryGetViewerId(out long viewerId)) return Unauthorized();
|
|
|
|
var info = await _battlePass.GetInfoAsync(viewerId, ct);
|
|
if (info is null) return Ok(new { }); // off-season: empty payload
|
|
return Ok(info);
|
|
}
|
|
}
|