fix: resolve circular import errors in TypeORM entities
- Use string-based @OneToMany relations in parent entities (wallet, ticket, service-plan) to break circular import chains that confused VS Code TS language server - Add .vscode/settings.json to suppress Tailwind CSS @tailwindcss unknownAtRules warnings - Reorder imports in child entities for consistency
This commit is contained in:
@@ -6,8 +6,8 @@ import {
|
||||
JoinColumn,
|
||||
CreateDateColumn,
|
||||
} from 'typeorm';
|
||||
import { PricingResourceType } from '../../common/enums';
|
||||
import { ServicePlan } from './service-plan.entity';
|
||||
import { PricingResourceType } from '../../common/enums';
|
||||
|
||||
@Entity('pricing_rules')
|
||||
export class PricingRule {
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
OneToMany,
|
||||
} from 'typeorm';
|
||||
import { BillingCycle, AppRuntime } from '../../common/enums';
|
||||
import { PricingRule } from './pricing-rule.entity';
|
||||
|
||||
@Entity('service_plans')
|
||||
export class ServicePlan {
|
||||
@@ -29,8 +28,8 @@ export class ServicePlan {
|
||||
@Column({ default: true })
|
||||
isActive: boolean;
|
||||
|
||||
@OneToMany(() => PricingRule, (rule) => rule.plan, { cascade: true, eager: true })
|
||||
pricingRules: PricingRule[];
|
||||
@OneToMany('PricingRule', 'plan', { cascade: true, eager: true })
|
||||
pricingRules: any[];
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
@@ -6,8 +6,8 @@ import {
|
||||
JoinColumn,
|
||||
CreateDateColumn,
|
||||
} from 'typeorm';
|
||||
import { TransactionType } from '../../common/enums';
|
||||
import { Wallet } from './wallet.entity';
|
||||
import { TransactionType } from '../../common/enums';
|
||||
|
||||
@Entity('wallet_transactions')
|
||||
export class WalletTransaction {
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
OneToMany,
|
||||
} from 'typeorm';
|
||||
import { User } from '../../users/entities/user.entity';
|
||||
import { WalletTransaction } from './wallet-transaction.entity';
|
||||
|
||||
@Entity('wallets')
|
||||
export class Wallet {
|
||||
@@ -26,8 +25,8 @@ export class Wallet {
|
||||
@Column({ unique: true })
|
||||
userId: string;
|
||||
|
||||
@OneToMany(() => WalletTransaction, (tx: WalletTransaction) => tx.wallet)
|
||||
transactions: WalletTransaction[];
|
||||
@OneToMany('WalletTransaction', 'wallet')
|
||||
transactions: any[];
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
Reference in New Issue
Block a user