39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import { Column, Entity, Index, PrimaryColumn } from 'typeorm';
|
|
import { TimestampedEntity } from './timestamped.entity';
|
|
|
|
export enum InspectionVisitAssetPlanningSource {
|
|
LEGACY = 'LEGACY',
|
|
AUTOMATIC = 'AUTOMATIC',
|
|
PREVENTIVE = 'PREVENTIVE',
|
|
VERIFICATION = 'VERIFICATION',
|
|
}
|
|
|
|
@Entity({ name: 'inspection_visit_assets' })
|
|
@Index('idx_inspection_visit_assets_asset_id', ['assetId'])
|
|
@Index('idx_inspection_visit_assets_included', ['visitId', 'included'])
|
|
export class InspectionVisitAsset extends TimestampedEntity {
|
|
@PrimaryColumn({ name: 'visit_id', type: 'uuid' })
|
|
visitId!: string;
|
|
|
|
@PrimaryColumn({ name: 'asset_id', type: 'uuid' })
|
|
assetId!: string;
|
|
|
|
@Column({ type: 'boolean', default: true })
|
|
included!: boolean;
|
|
|
|
@Column({ name: 'planning_source', type: 'varchar', length: 24, default: InspectionVisitAssetPlanningSource.LEGACY })
|
|
planningSource!: InspectionVisitAssetPlanningSource;
|
|
|
|
@Column({ name: 'exclusion_reason', type: 'text', nullable: true })
|
|
exclusionReason!: string | null;
|
|
|
|
@Column({ name: 'excluded_by', type: 'uuid', nullable: true })
|
|
excludedBy!: string | null;
|
|
|
|
@Column({ name: 'excluded_at', type: 'timestamptz', nullable: true })
|
|
excludedAt!: Date | null;
|
|
|
|
@Column({ name: 'added_by', type: 'uuid', nullable: true })
|
|
addedBy!: string | null;
|
|
}
|