feat(subscriptions): add Subscriptions module with plans, quotas, and billing

- Add Subscription, Plan, UsageRecord domain entities
- Implement Create, Upgrade, Cancel subscription commands
- Add MeterUsage command for quota tracking
- Support 4 plan tiers: Free, Agent Pro, Investor, Enterprise
- Register SubscriptionsModule in AppModule

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-08 02:04:20 +07:00
parent f3081d92fc
commit 9b581b7e5f
32 changed files with 1205 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
import { type SubscriptionEntity } from '../entities/subscription.entity';
export const SUBSCRIPTION_REPOSITORY = Symbol('SUBSCRIPTION_REPOSITORY');
export interface ISubscriptionRepository {
findById(id: string): Promise<SubscriptionEntity | null>;
findByUserId(userId: string): Promise<SubscriptionEntity | null>;
save(subscription: SubscriptionEntity): Promise<void>;
update(subscription: SubscriptionEntity): Promise<void>;
}