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:
@@ -1,4 +1,4 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { Module, forwardRef } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { BillingService } from './billing.service';
|
||||
import { BillingController } from './billing.controller';
|
||||
@@ -6,10 +6,13 @@ import { ServicePlan } from './entities/service-plan.entity';
|
||||
import { PricingRule } from './entities/pricing-rule.entity';
|
||||
import { Wallet } from './entities/wallet.entity';
|
||||
import { WalletTransaction } from './entities/wallet-transaction.entity';
|
||||
import { PlatformSetting } from './entities/platform-setting.entity';
|
||||
import { LifecycleModule } from '../lifecycle/lifecycle.module';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
TypeOrmModule.forFeature([ServicePlan, PricingRule, Wallet, WalletTransaction]),
|
||||
TypeOrmModule.forFeature([ServicePlan, PricingRule, Wallet, WalletTransaction, PlatformSetting]),
|
||||
forwardRef(() => LifecycleModule),
|
||||
],
|
||||
controllers: [BillingController],
|
||||
providers: [BillingService],
|
||||
|
||||
Reference in New Issue
Block a user