From 13f2dcfa959b54d5d17eb0506d1e4cad3b2e57ba Mon Sep 17 00:00:00 2001 From: enlineawork Date: Mon, 7 Sep 2026 20:44:34 -0300 Subject: [PATCH] feat(f4): add append-only INF follow-up timeline --- .../inspection-report-follow-up.entity.ts | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 api-v3/src/database/entities/inspection-report-follow-up.entity.ts diff --git a/api-v3/src/database/entities/inspection-report-follow-up.entity.ts b/api-v3/src/database/entities/inspection-report-follow-up.entity.ts new file mode 100644 index 0000000..e7b26e4 --- /dev/null +++ b/api-v3/src/database/entities/inspection-report-follow-up.entity.ts @@ -0,0 +1,50 @@ +import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm'; +import { TimestampedEntity } from './timestamped.entity'; + +export enum InspectionReportFollowUpType { + COMPANY_NOTE = 'COMPANY_NOTE', + COMPANY_DOCUMENT = 'COMPANY_DOCUMENT', + INTERNAL_NOTE = 'INTERNAL_NOTE', + VERIFICATION = 'VERIFICATION', + OTHER = 'OTHER', +} + +@Entity({ name: 'inspection_report_follow_ups' }) +@Index('idx_inspection_report_follow_ups_report_created', ['reportId', 'createdAt']) +export class InspectionReportFollowUp extends TimestampedEntity { + @PrimaryGeneratedColumn('uuid') + id!: string; + + @Column({ name: 'report_id', type: 'uuid' }) + reportId!: string; + + @Column({ type: 'varchar', length: 40 }) + type!: InspectionReportFollowUpType; + + @Column({ name: 'external_reference', type: 'varchar', length: 255, nullable: true }) + externalReference!: string | null; + + @Column({ name: 'occurred_at', type: 'timestamptz' }) + occurredAt!: Date; + + @Column({ type: 'text', nullable: true }) + description!: string | null; + + @Column({ name: 'original_name', type: 'varchar', length: 255, nullable: true }) + originalName!: string | null; + + @Column({ name: 'stored_name', type: 'varchar', length: 255, nullable: true }) + storedName!: string | null; + + @Column({ name: 'mime_type', type: 'varchar', length: 120, nullable: true }) + mimeType!: string | null; + + @Column({ name: 'size_bytes', type: 'integer', nullable: true }) + sizeBytes!: number | null; + + @Column({ name: 'sha256', type: 'char', length: 64, nullable: true }) + sha256!: string | null; + + @Column({ name: 'created_by', type: 'uuid', nullable: true }) + createdBy!: string | null; +}