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:
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"css.customData": [],
|
||||
"css.lint.unknownAtRules": "ignore",
|
||||
"scss.lint.unknownAtRules": "ignore"
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -6,9 +6,9 @@ import {
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
} from 'typeorm';
|
||||
import { Ticket } from './ticket.entity';
|
||||
import { User } from '../../users/entities/user.entity';
|
||||
import { UserRole } from '../../common/enums';
|
||||
import { Ticket } from './ticket.entity';
|
||||
|
||||
@Entity('ticket_messages')
|
||||
export class TicketMessage {
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
} from 'typeorm';
|
||||
import { TicketDepartment, TicketStatus, TicketPriority } from '../../common/enums';
|
||||
import { User } from '../../users/entities/user.entity';
|
||||
import { TicketMessage } from './ticket-message.entity';
|
||||
|
||||
@Entity('tickets')
|
||||
export class Ticket {
|
||||
@@ -36,8 +35,8 @@ export class Ticket {
|
||||
@JoinColumn({ name: 'userId' })
|
||||
user: User;
|
||||
|
||||
@OneToMany(() => TicketMessage, (msg) => msg.ticket, { cascade: true })
|
||||
messages: TicketMessage[];
|
||||
@OneToMany('TicketMessage', 'ticket', { cascade: true })
|
||||
messages: any[];
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
Reference in New Issue
Block a user