diff --git a/src/entities/User.ts b/src/entities/User.ts index b3019ea..96b36ec 100644 --- a/src/entities/User.ts +++ b/src/entities/User.ts @@ -108,6 +108,9 @@ export class User { @UpdateDateColumn() updatedAt!: Date; + @Column({ type: 'numeric', precision: 24, scale: 2, default: 0 }) + accountBalance!: number; + @BeforeInsert() setRole (): void { this.role = this.userType === 'Vendor' ? roles.vendor : roles.buyer; diff --git a/src/entities/transaction.ts b/src/entities/transaction.ts index defda7f..d475812 100644 --- a/src/entities/transaction.ts +++ b/src/entities/transaction.ts @@ -35,6 +35,16 @@ export class Transaction { @IsNumber() amount!: number; + @Column({ type: 'numeric', precision: 15, scale: 2, default: 0 }) + @IsNotEmpty() + @IsNumber() + previousBalance!: number; + + @Column({ type: 'numeric', precision: 15, scale: 2, default: 0 }) + @IsNotEmpty() + @IsNumber() + currentBalance!: number; + @Column({ type: 'enum', enum: ['debit', 'credit'] }) @IsNotEmpty() @IsString() @@ -48,4 +58,4 @@ export class Transaction { @UpdateDateColumn() updatedAt!: Date; -} +} \ No newline at end of file