Post detail page

This commit is contained in:
2025-08-04 01:46:26 +08:00
parent db5d631049
commit 1a05f16299
9 changed files with 133 additions and 8 deletions

View File

@@ -43,13 +43,11 @@ public class SubscriptionController(SubscriptionService subscriptions, AfdianPay
{
if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized();
var subs = await db.WalletSubscriptions
var subscription = await db.WalletSubscriptions
.Where(s => s.AccountId == currentUser.Id && s.IsActive)
.Where(s => EF.Functions.ILike(s.Identifier, prefix + "%"))
.OrderByDescending(s => s.BegunAt)
.ToListAsync();
if (subs.Count == 0) return NotFound();
var subscription = subs.FirstOrDefault(s => s.IsAvailable);
.FirstOrDefaultAsync();
if (subscription is null) return NotFound();
return Ok(subscription);