// eslint-disable-next-line import/no-named-as-default import Decimal from "decimal.js"; import { Column, Entity, ManyToOne } from "typeorm"; import { Wallet } from "./wallet.entity"; import { BaseEntity } from "../../../common/entities/base.entity"; import { DecimalTransformer } from "../../../common/transformers/decimal.transformer"; import { TransactionType } from "../enums/transaction-type.enum"; @Entity() export class WalletTransaction extends BaseEntity { @Column({ type: "int", generated: "identity", insert: false }) numericId: number; @ManyToOne(() => Wallet, (wallet) => wallet.transactions, { onDelete: "CASCADE", nullable: false }) wallet: Wallet; @Column({ type: "decimal", precision: 16, scale: 2, nullable: false, transformer: new DecimalTransformer() }) amount: Decimal; @Column({ type: "enum", enum: TransactionType, nullable: false }) type: TransactionType; @Column({ type: "text", nullable: false }) description: string; }