Replace billing plans with per-runtime usage pricing catalog.

Store explicit hourly/monthly/yearly rates in pricing_rates and addon_rates, compute deploy costs without cycle conversion, and simplify admin UI and wallet payment to cycle-only.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
keyhan
2026-05-15 18:10:54 +03:30
parent 5239e8aa94
commit 35235fe0fc
15 changed files with 1293 additions and 716 deletions
@@ -57,7 +57,6 @@ export class AppLifecycleService implements OnModuleInit, OnModuleDestroy {
async activateApp(
appId: string,
billingCycle: BillingCycle,
planId: string,
planExpiresAt?: Date,
): Promise<Application> {
const app = await this.appRepo.findOne({ where: { id: appId } });
@@ -68,7 +67,6 @@ export class AppLifecycleService implements OnModuleInit, OnModuleDestroy {
? planExpiresAt
: this.calculateExpiry(now, billingCycle);
app.planId = planId;
app.billingCycle = billingCycle;
app.lifecycleStatus = AppLifecycleStatus.ACTIVE;
app.planExpiresAt = expiresAt;
@@ -225,7 +223,7 @@ export class AppLifecycleService implements OnModuleInit, OnModuleDestroy {
// ─── Auto-renew for hourly plans ──────────────────────────────────
private async tryAutoRenew(app: Application): Promise<boolean> {
if (!app.planId) return false;
if (!app.billingCycle) return false;
try {
const cost = await this.billingService.calculateCostForApp(app);