inspection data model
This commit is contained in:
parent
95d1113ff9
commit
3ff44f7370
9 changed files with 222 additions and 21 deletions
35
src/entity/unit/inspection/inspectionVersionedPlan.ts
Normal file
35
src/entity/unit/inspection/inspectionVersionedPlan.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
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[];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue