feat(leader-skin): tag buy tx as LeaderSkinBuy for acquire history

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-09 15:07:19 -04:00
parent 30cb4727f6
commit 349d7f32cd

View File

@@ -177,7 +177,7 @@ public class LeaderSkinController : SVSimController
if (!product.IsEnabled || product.Series is not { IsEnabled: true })
return BadRequest(new { error = "product_not_available" });
await using var tx = await _inv.BeginAsync(viewerId, HttpContext.RequestAborted);
await using var tx = await _inv.BeginAsync(viewerId, HttpContext.RequestAborted, cfg => cfg.Source = GrantSource.LeaderSkinBuy);
// Already-purchased = viewer owns the leader_skin this product grants.
if (tx.OwnsCosmetic(CosmeticType.Skin, product.LeaderSkinId))
@@ -230,7 +230,7 @@ public class LeaderSkinController : SVSimController
if (!series.IsEnabled || series.SetSalesStatus == 0)
return BadRequest(new { error = "set_sale_not_active" });
await using var tx = await _inv.BeginAsync(viewerId, HttpContext.RequestAborted);
await using var tx = await _inv.BeginAsync(viewerId, HttpContext.RequestAborted, cfg => cfg.Source = GrantSource.LeaderSkinBuy);
if (tx.IsFreeplay)
return BadRequest(new { error = "already_purchased" });
@@ -286,7 +286,7 @@ public class LeaderSkinController : SVSimController
if (existingClaim is not null)
return new LeaderSkinBuyResponse { RewardList = new() };
await using var tx = await _inv.BeginAsync(viewerId, HttpContext.RequestAborted);
await using var tx = await _inv.BeginAsync(viewerId, HttpContext.RequestAborted, cfg => cfg.Source = GrantSource.LeaderSkinBuy);
// Must own every skin in the series to claim the bonus.
bool ownsAll = series.Products.Count > 0 && series.Products.All(p => tx.OwnsCosmetic(CosmeticType.Skin, p.LeaderSkinId));