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,
|
JoinColumn,
|
||||||
CreateDateColumn,
|
CreateDateColumn,
|
||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
import { PricingResourceType } from '../../common/enums';
|
|
||||||
import { ServicePlan } from './service-plan.entity';
|
import { ServicePlan } from './service-plan.entity';
|
||||||
|
import { PricingResourceType } from '../../common/enums';
|
||||||
|
|
||||||
@Entity('pricing_rules')
|
@Entity('pricing_rules')
|
||||||
export class PricingRule {
|
export class PricingRule {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
OneToMany,
|
OneToMany,
|
||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
import { BillingCycle, AppRuntime } from '../../common/enums';
|
import { BillingCycle, AppRuntime } from '../../common/enums';
|
||||||
import { PricingRule } from './pricing-rule.entity';
|
|
||||||
|
|
||||||
@Entity('service_plans')
|
@Entity('service_plans')
|
||||||
export class ServicePlan {
|
export class ServicePlan {
|
||||||
@@ -29,8 +28,8 @@ export class ServicePlan {
|
|||||||
@Column({ default: true })
|
@Column({ default: true })
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
|
|
||||||
@OneToMany(() => PricingRule, (rule) => rule.plan, { cascade: true, eager: true })
|
@OneToMany('PricingRule', 'plan', { cascade: true, eager: true })
|
||||||
pricingRules: PricingRule[];
|
pricingRules: any[];
|
||||||
|
|
||||||
@CreateDateColumn()
|
@CreateDateColumn()
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import {
|
|||||||
JoinColumn,
|
JoinColumn,
|
||||||
CreateDateColumn,
|
CreateDateColumn,
|
||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
import { TransactionType } from '../../common/enums';
|
|
||||||
import { Wallet } from './wallet.entity';
|
import { Wallet } from './wallet.entity';
|
||||||
|
import { TransactionType } from '../../common/enums';
|
||||||
|
|
||||||
@Entity('wallet_transactions')
|
@Entity('wallet_transactions')
|
||||||
export class WalletTransaction {
|
export class WalletTransaction {
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import {
|
|||||||
OneToMany,
|
OneToMany,
|
||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
import { User } from '../../users/entities/user.entity';
|
import { User } from '../../users/entities/user.entity';
|
||||||
import { WalletTransaction } from './wallet-transaction.entity';
|
|
||||||
|
|
||||||
@Entity('wallets')
|
@Entity('wallets')
|
||||||
export class Wallet {
|
export class Wallet {
|
||||||
@@ -26,8 +25,8 @@ export class Wallet {
|
|||||||
@Column({ unique: true })
|
@Column({ unique: true })
|
||||||
userId: string;
|
userId: string;
|
||||||
|
|
||||||
@OneToMany(() => WalletTransaction, (tx: WalletTransaction) => tx.wallet)
|
@OneToMany('WalletTransaction', 'wallet')
|
||||||
transactions: WalletTransaction[];
|
transactions: any[];
|
||||||
|
|
||||||
@CreateDateColumn()
|
@CreateDateColumn()
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import {
|
|||||||
ManyToOne,
|
ManyToOne,
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
import { Ticket } from './ticket.entity';
|
|
||||||
import { User } from '../../users/entities/user.entity';
|
import { User } from '../../users/entities/user.entity';
|
||||||
import { UserRole } from '../../common/enums';
|
import { UserRole } from '../../common/enums';
|
||||||
|
import { Ticket } from './ticket.entity';
|
||||||
|
|
||||||
@Entity('ticket_messages')
|
@Entity('ticket_messages')
|
||||||
export class TicketMessage {
|
export class TicketMessage {
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import {
|
|||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
import { TicketDepartment, TicketStatus, TicketPriority } from '../../common/enums';
|
import { TicketDepartment, TicketStatus, TicketPriority } from '../../common/enums';
|
||||||
import { User } from '../../users/entities/user.entity';
|
import { User } from '../../users/entities/user.entity';
|
||||||
import { TicketMessage } from './ticket-message.entity';
|
|
||||||
|
|
||||||
@Entity('tickets')
|
@Entity('tickets')
|
||||||
export class Ticket {
|
export class Ticket {
|
||||||
@@ -36,8 +35,8 @@ export class Ticket {
|
|||||||
@JoinColumn({ name: 'userId' })
|
@JoinColumn({ name: 'userId' })
|
||||||
user: User;
|
user: User;
|
||||||
|
|
||||||
@OneToMany(() => TicketMessage, (msg) => msg.ticket, { cascade: true })
|
@OneToMany('TicketMessage', 'ticket', { cascade: true })
|
||||||
messages: TicketMessage[];
|
messages: any[];
|
||||||
|
|
||||||
@CreateDateColumn()
|
@CreateDateColumn()
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
|
|||||||
Reference in New Issue
Block a user