feat: cap per-user AI token spend
CI and Deploy / test (push) Successful in 2m43s
CI and Deploy / deploy (push) Successful in 57s

This commit is contained in:
cesnimda
2026-07-30 23:32:13 +02:00
parent 09fc2b03f7
commit 792814b04e
5 changed files with 18 additions and 9 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
namespace JobTrackerApi.Models;
public sealed record AccountEntitlements(bool AdvancedAi, bool PremiumThemes, bool Automation, bool Analytics, long StorageBytes, int MonthlyAiCalls);
public sealed record AccountEntitlements(bool AdvancedAi, bool PremiumThemes, bool Automation, bool Analytics, long StorageBytes, int MonthlyAiCalls, long MonthlyAiTokens);
public static class AccountPlans
{
@@ -8,7 +8,7 @@ public static class AccountPlans
{
var premium = roles.Contains("Premium", StringComparer.OrdinalIgnoreCase) || roles.Contains("Admin", StringComparer.OrdinalIgnoreCase);
return premium
? new AccountEntitlements(true, true, true, true, 5_000_000_000, 250)
: new AccountEntitlements(false, false, false, false, 250_000_000, 25);
? new AccountEntitlements(true, true, true, true, 5_000_000_000, 250, 1_000_000)
: new AccountEntitlements(false, false, false, false, 250_000_000, 25, 100_000);
}
}