Refactor payment entity to use correlationId as primary key and remove unused fields
This commit is contained in:
parent
4c8b331be0
commit
3c2c43106a
@ -1,38 +1,16 @@
|
||||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
import { PaymentStatusEnum } from '../enumns/payment-status.enum';
|
||||
import { Column, CreateDateColumn, Entity, PrimaryColumn } from 'typeorm';
|
||||
|
||||
@Entity('payments')
|
||||
export class Payment {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
@PrimaryColumn({ type: 'uuid', name: 'correlation_id', unique: true })
|
||||
correlationId: string;
|
||||
|
||||
@Column({ type: 'decimal', precision: 10, scale: 2 })
|
||||
amount: number;
|
||||
|
||||
@Column({
|
||||
type: 'enum',
|
||||
enum: PaymentStatusEnum,
|
||||
default: PaymentStatusEnum.PENDING,
|
||||
})
|
||||
status: PaymentStatusEnum;
|
||||
|
||||
@Column({ type: 'varchar', name: 'payment_processor', nullable: true })
|
||||
paymentProcessor: string;
|
||||
|
||||
@Column({ type: 'uuid', name: 'correlation_id', unique: true })
|
||||
correlationId: string;
|
||||
|
||||
@Column({ type: 'text', nullable: true })
|
||||
errorMessage: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
attempts: number;
|
||||
|
||||
@CreateDateColumn({ type: 'timestamp', name: 'created_at' })
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user