diff --git a/api-v3/src/database/entities/inspection-report.entity.ts b/api-v3/src/database/entities/inspection-report.entity.ts index 77c4291..7742475 100644 --- a/api-v3/src/database/entities/inspection-report.entity.ts +++ b/api-v3/src/database/entities/inspection-report.entity.ts @@ -2,6 +2,8 @@ import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm'; import { TimestampedEntity } from './timestamped.entity'; export enum InspectionReportStatus { + WORKING = 'WORKING', + OFFICIALIZED = 'OFFICIALIZED', FROZEN = 'FROZEN', CANCELLED = 'CANCELLED', } @@ -18,6 +20,7 @@ export enum InspectionReportWordStatus { FAILED = 'FAILED', } +/** @deprecated El circuito Director/aprobación/firma se retira en F4. */ export enum InspectionReportReviewStatus { PENDING_REVIEW = 'PENDING_REVIEW', APPROVED = 'APPROVED', @@ -31,6 +34,7 @@ export enum InspectionReportReviewStatus { @Index('uq_inspection_reports_code', ['code'], { unique: true }) @Index('idx_inspection_reports_generated_at', ['generatedAt']) @Index('idx_inspection_reports_status', ['status', 'pdfStatus']) +@Index('idx_inspection_reports_gedo_officialized_at', ['gedoOfficializedAt']) export class InspectionReport extends TimestampedEntity { @PrimaryGeneratedColumn('uuid') id!: string; @@ -47,12 +51,39 @@ export class InspectionReport extends TimestampedEntity { @Column({ name: 'report_number', type: 'integer' }) reportNumber!: number; - @Column({ type: 'varchar', length: 24 }) + @Column({ type: 'varchar', length: 40 }) code!: string; - @Column({ type: 'varchar', length: 24, default: InspectionReportStatus.FROZEN }) + @Column({ type: 'varchar', length: 24, default: InspectionReportStatus.WORKING }) status!: InspectionReportStatus; + @Column({ name: 'executive_summary', type: 'text', nullable: true }) + executiveSummary!: string | null; + + @Column({ name: 'report_description', type: 'text', nullable: true }) + reportDescription!: string | null; + + @Column({ name: 'gedo_if_identifier', type: 'varchar', length: 255, nullable: true }) + gedoIfIdentifier!: string | null; + + @Column({ name: 'gedo_officialized_at', type: 'timestamptz', nullable: true }) + gedoOfficializedAt!: Date | null; + + @Column({ name: 'gedo_pdf_original_name', type: 'varchar', length: 255, nullable: true }) + gedoPdfOriginalName!: string | null; + + @Column({ name: 'gedo_pdf_stored_name', type: 'varchar', length: 255, nullable: true }) + gedoPdfStoredName!: string | null; + + @Column({ name: 'gedo_pdf_mime_type', type: 'varchar', length: 120, nullable: true }) + gedoPdfMimeType!: string | null; + + @Column({ name: 'gedo_pdf_size_bytes', type: 'integer', nullable: true }) + gedoPdfSizeBytes!: number | null; + + @Column({ name: 'gedo_pdf_sha256', type: 'char', length: 64, nullable: true }) + gedoPdfSha256!: string | null; + @Column({ name: 'pdf_status', type: 'varchar', length: 24, default: InspectionReportPdfStatus.PENDING }) pdfStatus!: InspectionReportPdfStatus; @@ -80,6 +111,7 @@ export class InspectionReport extends TimestampedEntity { @Column({ name: 'word_error', type: 'varchar', length: 500, nullable: true }) wordError!: string | null; + // Campos legacy del circuito Director, conservados sólo hasta completar la migración F4. @Column({ name: 'review_status', type: 'varchar', length: 32, default: InspectionReportReviewStatus.PENDING_REVIEW }) reviewStatus!: InspectionReportReviewStatus;