65 lines
1.8 KiB
TypeScript
65 lines
1.8 KiB
TypeScript
import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
|
|
|
|
export enum InspectionCommunicationDirection {
|
|
INBOUND = 'INBOUND',
|
|
OUTBOUND = 'OUTBOUND',
|
|
INTERNAL = 'INTERNAL',
|
|
}
|
|
|
|
export enum InspectionCommunicationChannel {
|
|
EMAIL = 'EMAIL',
|
|
IN_PERSON = 'IN_PERSON',
|
|
PHONE = 'PHONE',
|
|
LETTER = 'LETTER',
|
|
SYSTEM = 'SYSTEM',
|
|
OTHER = 'OTHER',
|
|
}
|
|
|
|
export enum InspectionCommunicationType {
|
|
COMPANY_RESPONSE = 'COMPANY_RESPONSE',
|
|
AUTHORITY_NOTICE = 'AUTHORITY_NOTICE',
|
|
FOLLOW_UP = 'FOLLOW_UP',
|
|
OTHER = 'OTHER',
|
|
}
|
|
|
|
@Entity({ name: 'inspection_finding_communications' })
|
|
@Index('uq_inspection_finding_communications_id_finding', ['id', 'findingId'], { unique: true })
|
|
@Index('idx_inspection_finding_communications_timeline', ['findingId', 'occurredAt'])
|
|
export class InspectionFindingCommunication {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id!: string;
|
|
|
|
@Column({ name: 'finding_id', type: 'uuid' })
|
|
findingId!: string;
|
|
|
|
@Column({ type: 'varchar', length: 20 })
|
|
direction!: InspectionCommunicationDirection;
|
|
|
|
@Column({ type: 'varchar', length: 20 })
|
|
channel!: InspectionCommunicationChannel;
|
|
|
|
@Column({ type: 'varchar', length: 32 })
|
|
type!: InspectionCommunicationType;
|
|
|
|
@Column({ name: 'occurred_at', type: 'timestamptz' })
|
|
occurredAt!: Date;
|
|
|
|
@Column({ type: 'varchar', length: 250 })
|
|
subject!: string;
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
details!: string | null;
|
|
|
|
@Column({ name: 'contact_name', type: 'varchar', length: 200, nullable: true })
|
|
contactName!: string | null;
|
|
|
|
@Column({ name: 'contact_email', type: 'varchar', length: 320, nullable: true })
|
|
contactEmail!: string | null;
|
|
|
|
@Column({ name: 'created_by', type: 'uuid', nullable: true })
|
|
createdBy!: string | null;
|
|
|
|
@Column({ name: 'created_at', type: 'timestamptz', default: () => 'CURRENT_TIMESTAMP' })
|
|
createdAt!: Date;
|
|
}
|