feat(sleeve): /sleeve/sleeve_list returns owned ids

This commit is contained in:
gamer147
2026-06-12 23:17:10 -04:00
parent e2f5786b60
commit f879c05dca
3 changed files with 83 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ using SVSim.EmulatedEntrypoint.Models.Dtos;
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests.Sleeve;
using SVSim.EmulatedEntrypoint.Models.Dtos.Responses.Sleeve;
using SVSim.EmulatedEntrypoint.Models.Dtos.Common;
namespace SVSim.EmulatedEntrypoint.Controllers;
@@ -152,6 +153,22 @@ public class SleeveController : SVSimController
};
}
[HttpPost("sleeve_list")]
public async Task<ActionResult<List<SleeveListEntry>>> SleeveList(BaseRequest _, CancellationToken ct)
{
if (!TryGetViewerId(out long viewerId)) return Unauthorized();
var viewer = await _db.Viewers
.Include(v => v.Sleeves)
.FirstOrDefaultAsync(v => v.Id == viewerId, ct);
if (viewer is null) return Unauthorized();
return viewer.Sleeves
.Select(s => new SleeveListEntry { SleeveId = s.Id })
.OrderBy(e => e.SleeveId)
.ToList();
}
/// <summary>
/// A product is "purchased" once the viewer owns at least one of its sleeve-typed reward
/// grants. Emblem/other grants aren't load-bearing for this check — a viewer who somehow