Files
cloud-host/backend/src/billing/entities/wallet-transaction.entity.ts
T
keyhan ecedf9119e 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
2026-04-08 12:30:15 +03:30

42 lines
1.0 KiB
TypeScript

import {
Entity,
PrimaryGeneratedColumn,
Column,
ManyToOne,
JoinColumn,
CreateDateColumn,
} from 'typeorm';
import { Wallet } from './wallet.entity';
import { TransactionType } from '../../common/enums';
@Entity('wallet_transactions')
export class WalletTransaction {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({ type: 'enum', enum: TransactionType })
type: TransactionType;
@Column({ type: 'decimal', precision: 14, scale: 2 })
amount: number; // Amount in Toman (positive)
@Column({ type: 'decimal', precision: 14, scale: 2 })
balanceAfter: number; // Balance after this transaction
@Column({ nullable: true })
description: string; // e.g. "Charge via admin", "Payment for app: my-app (monthly)"
@Column({ nullable: true })
applicationId: string; // Linked application (for deductions)
@ManyToOne(() => Wallet, (wallet: Wallet) => wallet.transactions, { onDelete: 'CASCADE' })
@JoinColumn({ name: 'walletId' })
wallet: Wallet;
@Column()
walletId: string;
@CreateDateColumn()
createdAt: Date;
}