chore: complete the payment service
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user