57 lines
1.8 KiB
TypeScript
57 lines
1.8 KiB
TypeScript
import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
|
|
import { TimestampedEntity } from './timestamped.entity';
|
|
|
|
export enum FindingCatalogProposalStatus {
|
|
PENDING = 'PENDING',
|
|
MATCHED = 'MATCHED',
|
|
REJECTED = 'REJECTED',
|
|
}
|
|
|
|
@Entity({ name: 'finding_catalog_proposals' })
|
|
@Index('uq_finding_catalog_proposals_finding', ['findingId'], { unique: true })
|
|
@Index('idx_finding_catalog_proposals_status', ['status', 'createdAt'])
|
|
@Index('idx_finding_catalog_proposals_asset_type', ['assetTypeId', 'status'])
|
|
export class FindingCatalogProposal extends TimestampedEntity {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id!: string;
|
|
|
|
@Column({ name: 'finding_id', type: 'uuid' })
|
|
findingId!: string;
|
|
|
|
@Column({ name: 'asset_id', type: 'uuid' })
|
|
assetId!: string;
|
|
|
|
@Column({ name: 'asset_type_id', type: 'uuid' })
|
|
assetTypeId!: string;
|
|
|
|
@Column({ name: 'proposed_title', type: 'varchar', length: 500 })
|
|
proposedTitle!: string;
|
|
|
|
@Column({ name: 'proposed_legal_basis', type: 'text', nullable: true })
|
|
proposedLegalBasis!: string | null;
|
|
|
|
@Column({ name: 'proposed_severity', type: 'smallint', nullable: true })
|
|
proposedSeverity!: number | null;
|
|
|
|
@Column({ type: 'text' })
|
|
description!: string;
|
|
|
|
@Column({ type: 'varchar', length: 20, default: FindingCatalogProposalStatus.PENDING })
|
|
status!: FindingCatalogProposalStatus;
|
|
|
|
@Column({ name: 'resolved_catalog_item_id', type: 'uuid', nullable: true })
|
|
resolvedCatalogItemId!: string | null;
|
|
|
|
@Column({ name: 'office_notes', type: 'text', nullable: true })
|
|
officeNotes!: string | null;
|
|
|
|
@Column({ name: 'reviewed_by', type: 'uuid', nullable: true })
|
|
reviewedBy!: string | null;
|
|
|
|
@Column({ name: 'reviewed_at', type: 'timestamptz', nullable: true })
|
|
reviewedAt!: Date | null;
|
|
|
|
@Column({ name: 'created_by', type: 'uuid', nullable: true })
|
|
createdBy!: string | null;
|
|
}
|