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 {
|
import { Column, CreateDateColumn, Entity, PrimaryColumn } from 'typeorm';
|
||||||
Column,
|
|
||||||
CreateDateColumn,
|
|
||||||
Entity,
|
|
||||||
PrimaryGeneratedColumn,
|
|
||||||
} from 'typeorm';
|
|
||||||
import { PaymentStatusEnum } from '../enumns/payment-status.enum';
|
|
||||||
|
|
||||||
@Entity('payments')
|
@Entity('payments')
|
||||||
export class Payment {
|
export class Payment {
|
||||||
@PrimaryGeneratedColumn('uuid')
|
@PrimaryColumn({ type: 'uuid', name: 'correlation_id', unique: true })
|
||||||
id: string;
|
correlationId: string;
|
||||||
|
|
||||||
@Column({ type: 'decimal', precision: 10, scale: 2 })
|
@Column({ type: 'decimal', precision: 10, scale: 2 })
|
||||||
amount: number;
|
amount: number;
|
||||||
|
|
||||||
@Column({
|
|
||||||
type: 'enum',
|
|
||||||
enum: PaymentStatusEnum,
|
|
||||||
default: PaymentStatusEnum.PENDING,
|
|
||||||
})
|
|
||||||
status: PaymentStatusEnum;
|
|
||||||
|
|
||||||
@Column({ type: 'varchar', name: 'payment_processor', nullable: true })
|
@Column({ type: 'varchar', name: 'payment_processor', nullable: true })
|
||||||
paymentProcessor: string;
|
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' })
|
@CreateDateColumn({ type: 'timestamp', name: 'created_at' })
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user