Putting the stellar perks back

This commit is contained in:
2025-07-23 18:20:47 +08:00
parent b4c8096c41
commit 8e61a8b43d
6 changed files with 169 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
using System.ComponentModel.DataAnnotations;
using DysonNetwork.Pass.Auth;
using DysonNetwork.Pass.Wallet;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using NodaTime;
@@ -12,6 +13,7 @@ public class AccountController(
AppDatabase db,
AuthService auth,
AccountService accounts,
SubscriptionService subscriptions,
AccountEventService events
) : ControllerBase
{
@@ -25,7 +27,12 @@ public class AccountController(
.Include(e => e.Profile)
.Where(a => a.Name == name)
.FirstOrDefaultAsync();
return account is null ? new NotFoundResult() : account;
if (account is null) return new NotFoundResult();
var perk = await subscriptions.GetPerkSubscriptionAsync(account.Id);
account.PerkSubscription = perk?.ToReference();
return account;
}
[HttpGet("{name}/badges")]