feat(lifecycle): add billing lifecycle with auto-suspend/delete
- New AppLifecycleService with cron-based scanner (60s interval) - State machine: ACTIVE → SUSPENDED → PENDING_DELETION → DELETED - Auto-renew hourly plans from wallet - Admin-configurable grace periods via PlatformSettings table - New LifecycleController (GET/PATCH /lifecycle/settings) - PlatformSetting entity for runtime admin config - BillingService: calculateCostForApp, deductWallet - Application entity: planId, billingCycle, lifecycleStatus, planExpiresAt - New enums: AppLifecycleStatus, BillingCycle
This commit is contained in:
@@ -80,3 +80,12 @@ export enum TransactionType {
|
||||
DEDUCTION = 'deduction', // Payment for service
|
||||
REFUND = 'refund', // Refund
|
||||
}
|
||||
|
||||
// ── Application Lifecycle ─────────────────────────────
|
||||
|
||||
export enum AppLifecycleStatus {
|
||||
ACTIVE = 'active', // Paid & running
|
||||
SUSPENDED = 'suspended', // Plan expired, pods scaled to 0, data retained
|
||||
PENDING_DELETION = 'pending_deletion', // Grace period — will be deleted if no payment
|
||||
DELETED = 'deleted', // Fully removed from K8s and DB
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user