Skip to content

Commit

Permalink
Merge branch 'ft-stripe-payment' of https://github.com/atlp-rwanda/kn…
Browse files Browse the repository at this point in the history
…ights-ecomm-be into ft-stripe-payment
  • Loading branch information
maxCastro1 committed May 29, 2024
2 parents 87f16e1 + b1fc7d8 commit e6191c7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/entities/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 11 additions & 1 deletion src/entities/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -48,4 +58,4 @@ export class Transaction {

@UpdateDateColumn()
updatedAt!: Date;
}
}

0 comments on commit e6191c7

Please sign in to comment.