From 3c2c43106aef02c19b1f8b47fd45bbf68af183dc Mon Sep 17 00:00:00 2001 From: jos3duardo Date: Tue, 12 Aug 2025 09:09:25 -0400 Subject: [PATCH] Refactor payment entity to use correlationId as primary key and remove unused fields --- .../payments/entities/payment.entity.ts | 28 ++----------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/src/modules/payments/entities/payment.entity.ts b/src/modules/payments/entities/payment.entity.ts index 54a3068..fe01320 100644 --- a/src/modules/payments/entities/payment.entity.ts +++ b/src/modules/payments/entities/payment.entity.ts @@ -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; }