74 lines
2.3 KiB
TypeScript
74 lines
2.3 KiB
TypeScript
import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
|
|
import { TimestampedEntity } from './timestamped.entity';
|
|
|
|
export enum SurveyReportOutcome {
|
|
CONFIRMED = 'CONFIRMED',
|
|
CHANGES_RECORDED = 'CHANGES_RECORDED',
|
|
NOT_LOCATED = 'NOT_LOCATED',
|
|
}
|
|
|
|
export enum SurveyReportStatus {
|
|
DRAFT = 'DRAFT',
|
|
SUBMITTED = 'SUBMITTED',
|
|
APPROVED = 'APPROVED',
|
|
REJECTED = 'REJECTED',
|
|
}
|
|
|
|
@Entity({ name: 'survey_target_reports' })
|
|
@Index('uq_survey_target_reports_target_id', ['targetId'], { unique: true })
|
|
@Index('idx_survey_target_reports_status', ['status'])
|
|
@Index('idx_survey_target_reports_submitted_by', ['submittedBy'])
|
|
@Index('idx_survey_target_reports_reviewed_by', ['reviewedBy'])
|
|
export class SurveyTargetReport extends TimestampedEntity {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id!: string;
|
|
|
|
@Column({ name: 'target_id', type: 'uuid' })
|
|
targetId!: string;
|
|
|
|
@Column({ type: 'varchar', length: 32, nullable: true })
|
|
outcome!: SurveyReportOutcome | null;
|
|
|
|
@Column({ type: 'varchar', length: 24, default: SurveyReportStatus.DRAFT })
|
|
status!: SurveyReportStatus;
|
|
|
|
@Column({ name: 'observed_at', type: 'timestamptz', nullable: true })
|
|
observedAt!: Date | null;
|
|
|
|
@Column({ type: 'numeric', precision: 9, scale: 6, nullable: true })
|
|
latitude!: string | null;
|
|
|
|
@Column({ type: 'numeric', precision: 9, scale: 6, nullable: true })
|
|
longitude!: string | null;
|
|
|
|
@Column({ name: 'accuracy_m', type: 'numeric', precision: 12, scale: 3, nullable: true })
|
|
accuracyM!: string | null;
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
notes!: string | null;
|
|
|
|
@Column({ name: 'asset_version_at_submission', type: 'integer', nullable: true })
|
|
assetVersionAtSubmission!: number | null;
|
|
|
|
@Column({ name: 'submitted_at', type: 'timestamptz', nullable: true })
|
|
submittedAt!: Date | null;
|
|
|
|
@Column({ name: 'submitted_by', type: 'uuid', nullable: true })
|
|
submittedBy!: string | null;
|
|
|
|
@Column({ name: 'reviewed_at', type: 'timestamptz', nullable: true })
|
|
reviewedAt!: Date | null;
|
|
|
|
@Column({ name: 'reviewed_by', type: 'uuid', nullable: true })
|
|
reviewedBy!: string | null;
|
|
|
|
@Column({ name: 'review_notes', type: 'text', nullable: true })
|
|
reviewNotes!: string | null;
|
|
|
|
@Column({ name: 'created_by', type: 'uuid', nullable: true })
|
|
createdBy!: string | null;
|
|
|
|
@Column({ name: 'updated_by', type: 'uuid', nullable: true })
|
|
updatedBy!: string | null;
|
|
}
|