36 lines
1 KiB
TypeScript
36 lines
1 KiB
TypeScript
|
import { Column, CreateDateColumn, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn, Unique } from "typeorm";
|
||
|
import { Equipment } from "../equipment/equipment";
|
||
|
import { Vehicle } from "../vehicle/vehicle";
|
||
|
import { PlanTimeDefinition } from "../../../viewmodel/admin/unit/inspectionPlan/inspectionPlan.models";
|
||
|
import { inspectionPlan } from "./inspectionPlan";
|
||
|
import { getTypeByORM } from "../../../migrations/ormHelper";
|
||
|
import { inspectionPoint } from "./inspectionPoint";
|
||
|
|
||
|
@Entity()
|
||
|
@Unique("unique_version", ["version", "inspectionPlanId"])
|
||
|
export class inspectionVersionedPlan {
|
||
|
@PrimaryGeneratedColumn("uuid")
|
||
|
id: string;
|
||
|
|
||
|
@Column({ type: "int", default: 0 })
|
||
|
version: number;
|
||
|
|
||
|
@CreateDateColumn()
|
||
|
created: Date;
|
||
|
|
||
|
@Column()
|
||
|
inspectionPlanId: string;
|
||
|
|
||
|
@ManyToOne(() => inspectionPlan, {
|
||
|
nullable: false,
|
||
|
onDelete: "CASCADE",
|
||
|
onUpdate: "RESTRICT",
|
||
|
})
|
||
|
inspectionPlan: inspectionPlan;
|
||
|
|
||
|
@OneToMany(() => inspectionPoint, (ip) => ip.versionedPlan, {
|
||
|
cascade: ["insert"],
|
||
|
})
|
||
|
inspectionPoints: inspectionPoint[];
|
||
|
}
|