ff-admin-server/src/entity/unit/inspection/inspection.ts

36 lines
1 KiB
TypeScript

import { Column, ColumnType, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
import { inspectionPlan } from "./inspectionPlan";
import { inspectionVersionedPlan } from "./inspectionVersionedPlan";
import { getTypeByORM } from "../../../migrations/ormHelper";
import { Vehicle } from "../vehicle/vehicle";
import { Equipment } from "../equipment/equipment";
@Entity()
export class inspection {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column({ type: "text" })
context: string;
@CreateDateColumn()
createdAt: Date;
@Column({ type: getTypeByORM("date").type as ColumnType, nullable: true })
finished?: Date;
@Column({ type: getTypeByORM("date").type as ColumnType, nullable: true })
nextInspection?: Date;
@ManyToOne(() => inspectionPlan)
inspectionPlan: inspectionPlan;
@ManyToOne(() => inspectionVersionedPlan)
inspectionVersionedPlan: inspectionVersionedPlan;
@ManyToOne(() => Equipment)
equipment: Equipment;
@ManyToOne(() => Vehicle)
vehicle: Vehicle;
}