🐛 Trying to fix more subscription issue
This commit is contained in:
		@@ -9,7 +9,8 @@ namespace DysonNetwork.Pass.Wallet;
 | 
			
		||||
 | 
			
		||||
[ApiController]
 | 
			
		||||
[Route("/api/subscriptions")]
 | 
			
		||||
public class SubscriptionController(SubscriptionService subscriptions, AfdianPaymentHandler afdian, AppDatabase db) : ControllerBase
 | 
			
		||||
public class SubscriptionController(SubscriptionService subscriptions, AfdianPaymentHandler afdian, AppDatabase db)
 | 
			
		||||
    : ControllerBase
 | 
			
		||||
{
 | 
			
		||||
    [HttpGet]
 | 
			
		||||
    [Authorize]
 | 
			
		||||
@@ -48,7 +49,7 @@ public class SubscriptionController(SubscriptionService subscriptions, AfdianPay
 | 
			
		||||
            .Where(s => EF.Functions.ILike(s.Identifier, prefix + "%"))
 | 
			
		||||
            .OrderByDescending(s => s.BegunAt)
 | 
			
		||||
            .FirstOrDefaultAsync();
 | 
			
		||||
        if (subscription is null) return NotFound();
 | 
			
		||||
        if (subscription is null || !subscription.IsAvailable) return NotFound();
 | 
			
		||||
 | 
			
		||||
        return Ok(subscription);
 | 
			
		||||
    }
 | 
			
		||||
@@ -199,4 +200,4 @@ public class SubscriptionController(SubscriptionService subscriptions, AfdianPay
 | 
			
		||||
 | 
			
		||||
        return Ok(response);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
@@ -399,6 +399,7 @@ public class SubscriptionService(
 | 
			
		||||
            .Where(s => s.AccountId == accountId && identifiers.Contains(s.Identifier))
 | 
			
		||||
            .OrderByDescending(s => s.BegunAt)
 | 
			
		||||
            .FirstOrDefaultAsync();
 | 
			
		||||
        if (subscription is { IsAvailable: false }) subscription = null;
 | 
			
		||||
 | 
			
		||||
        // Cache the result if found (with 5 minutes expiry)
 | 
			
		||||
        if (subscription != null)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user