feat(bp): /battle_pass/info — service + controller + 3 tests
Also fixes BattlePassRepository.GetActiveSeasonAsync to use client-side DateTimeOffset filtering (SQLite provider cannot translate DateTimeOffset comparisons in LINQ WHERE/ORDER BY clauses).
This commit is contained in:
31
SVSim.EmulatedEntrypoint/Controllers/BattlePassController.cs
Normal file
31
SVSim.EmulatedEntrypoint/Controllers/BattlePassController.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user