chore: complete the payment service

This commit is contained in:
mahyargdz
2025-02-04 16:12:33 +03:30
parent 5d91afcc6e
commit 626206c389
25 changed files with 296 additions and 82 deletions
@@ -1,16 +1,22 @@
// 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: 10, scale: 2, nullable: false })
amount: number;
@Column({ type: "decimal", precision: 16, scale: 2, nullable: false, transformer: new DecimalTransformer() })
amount: Decimal;
@Column({ type: "enum", enum: TransactionType, nullable: false })
type: TransactionType;