chore: import DH V2 D5.6.4 production baseline
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
|
||||
import { TimestampedEntity } from './timestamped.entity';
|
||||
|
||||
export enum InspectionReportStatus {
|
||||
FROZEN = 'FROZEN',
|
||||
CANCELLED = 'CANCELLED',
|
||||
}
|
||||
|
||||
export enum InspectionReportPdfStatus {
|
||||
PENDING = 'PENDING',
|
||||
READY = 'READY',
|
||||
FAILED = 'FAILED',
|
||||
}
|
||||
|
||||
export enum InspectionReportWordStatus {
|
||||
PENDING = 'PENDING',
|
||||
READY = 'READY',
|
||||
FAILED = 'FAILED',
|
||||
}
|
||||
|
||||
export enum InspectionReportReviewStatus {
|
||||
PENDING_REVIEW = 'PENDING_REVIEW',
|
||||
APPROVED = 'APPROVED',
|
||||
SIGNED = 'SIGNED',
|
||||
}
|
||||
|
||||
@Entity({ name: 'inspection_reports' })
|
||||
@Index('uq_inspection_reports_visit', ['visitId'], { unique: true })
|
||||
@Index('uq_inspection_reports_act', ['actId'], { unique: true })
|
||||
@Index('uq_inspection_reports_year_number', ['reportYear', 'reportNumber'], { unique: true })
|
||||
@Index('uq_inspection_reports_code', ['code'], { unique: true })
|
||||
@Index('idx_inspection_reports_generated_at', ['generatedAt'])
|
||||
@Index('idx_inspection_reports_status', ['status', 'pdfStatus'])
|
||||
export class InspectionReport extends TimestampedEntity {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id!: string;
|
||||
|
||||
@Column({ name: 'visit_id', type: 'uuid' })
|
||||
visitId!: string;
|
||||
|
||||
@Column({ name: 'act_id', type: 'uuid' })
|
||||
actId!: string;
|
||||
|
||||
@Column({ name: 'report_year', type: 'integer' })
|
||||
reportYear!: number;
|
||||
|
||||
@Column({ name: 'report_number', type: 'integer' })
|
||||
reportNumber!: number;
|
||||
|
||||
@Column({ type: 'varchar', length: 24 })
|
||||
code!: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 24, default: InspectionReportStatus.FROZEN })
|
||||
status!: InspectionReportStatus;
|
||||
|
||||
@Column({ name: 'pdf_status', type: 'varchar', length: 24, default: InspectionReportPdfStatus.PENDING })
|
||||
pdfStatus!: InspectionReportPdfStatus;
|
||||
|
||||
@Column({ name: 'word_status', type: 'varchar', length: 24, default: InspectionReportWordStatus.PENDING })
|
||||
wordStatus!: InspectionReportWordStatus;
|
||||
|
||||
@Column({ name: 'word_original_name', type: 'varchar', length: 255, nullable: true })
|
||||
wordOriginalName!: string | null;
|
||||
|
||||
@Column({ name: 'word_stored_name', type: 'varchar', length: 255, nullable: true })
|
||||
wordStoredName!: string | null;
|
||||
|
||||
@Column({ name: 'word_mime_type', type: 'varchar', length: 120, nullable: true })
|
||||
wordMimeType!: string | null;
|
||||
|
||||
@Column({ name: 'word_size_bytes', type: 'integer', nullable: true })
|
||||
wordSizeBytes!: number | null;
|
||||
|
||||
@Column({ name: 'word_sha256', type: 'char', length: 64, nullable: true })
|
||||
wordSha256!: string | null;
|
||||
|
||||
@Column({ name: 'word_generated_at', type: 'timestamptz', nullable: true })
|
||||
wordGeneratedAt!: Date | null;
|
||||
|
||||
@Column({ name: 'word_error', type: 'varchar', length: 500, nullable: true })
|
||||
wordError!: string | null;
|
||||
|
||||
@Column({ name: 'review_status', type: 'varchar', length: 32, default: InspectionReportReviewStatus.PENDING_REVIEW })
|
||||
reviewStatus!: InspectionReportReviewStatus;
|
||||
|
||||
@Column({ name: 'current_revision_number', type: 'integer', default: 0 })
|
||||
currentRevisionNumber!: number;
|
||||
|
||||
@Column({ name: 'approved_revision_id', type: 'uuid', nullable: true })
|
||||
approvedRevisionId!: string | null;
|
||||
|
||||
@Column({ name: 'approved_by', type: 'uuid', nullable: true })
|
||||
approvedBy!: string | null;
|
||||
|
||||
@Column({ name: 'approved_at', type: 'timestamptz', nullable: true })
|
||||
approvedAt!: Date | null;
|
||||
|
||||
@Column({ name: 'review_note', type: 'varchar', length: 1000, nullable: true })
|
||||
reviewNote!: string | null;
|
||||
|
||||
@Column({ name: 'signed_at', type: 'timestamptz', nullable: true })
|
||||
signedAt!: Date | null;
|
||||
|
||||
@Column({ type: 'varchar', length: 220 })
|
||||
title!: string;
|
||||
|
||||
@Column({ name: 'act_version', type: 'integer' })
|
||||
actVersion!: number;
|
||||
|
||||
@Column({ name: 'act_closure_sha256', type: 'char', length: 64 })
|
||||
actClosureSha256!: string;
|
||||
|
||||
@Column({ name: 'frozen_sha256', type: 'char', length: 64 })
|
||||
frozenSha256!: string;
|
||||
|
||||
@Column({ name: 'frozen_snapshot', type: 'jsonb' })
|
||||
frozenSnapshot!: Record<string, unknown>;
|
||||
|
||||
@Column({ name: 'generated_at', type: 'timestamptz' })
|
||||
generatedAt!: Date;
|
||||
|
||||
@Column({ name: 'generated_by', type: 'uuid' })
|
||||
generatedBy!: string;
|
||||
}
|
||||
Reference in New Issue
Block a user