2025-05-24 13:51:38 +02:00
|
|
|
import { Column, CreateDateColumn, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
2025-05-25 07:01:13 +02:00
|
|
|
import { equipment } from "../equipment/equipment";
|
|
|
|
import { vehicle } from "../vehicle/vehicle";
|
2025-05-28 18:30:00 +02:00
|
|
|
import { PlanTimeDefinition } from "../../../viewmodel/admin/unit/inspection/inspectionPlan.models";
|
2025-05-24 13:51:38 +02:00
|
|
|
import { inspectionVersionedPlan } from "./inspectionVersionedPlan";
|
|
|
|
|
|
|
|
@Entity()
|
|
|
|
export class inspectionPlan {
|
|
|
|
@PrimaryGeneratedColumn("uuid")
|
|
|
|
id: string;
|
|
|
|
|
|
|
|
@Column({ type: "varchar", length: 255 })
|
|
|
|
title: string;
|
|
|
|
|
|
|
|
@Column({ type: "varchar", length: 255 })
|
|
|
|
inspectionInterval: PlanTimeDefinition;
|
|
|
|
|
|
|
|
@Column({ type: "varchar", length: 255 })
|
|
|
|
remindTime: PlanTimeDefinition;
|
|
|
|
|
|
|
|
@CreateDateColumn()
|
2025-05-26 14:53:25 +02:00
|
|
|
createdAt: Date;
|
2025-05-24 13:51:38 +02:00
|
|
|
|
|
|
|
@Column()
|
2025-05-28 18:30:00 +02:00
|
|
|
equipmentId?: string;
|
2025-05-24 13:51:38 +02:00
|
|
|
|
|
|
|
@Column()
|
2025-05-28 18:30:00 +02:00
|
|
|
vehicleId?: string;
|
2025-05-24 13:51:38 +02:00
|
|
|
|
2025-05-28 18:30:00 +02:00
|
|
|
@ManyToOne(() => equipment, {
|
|
|
|
nullable: true,
|
|
|
|
onDelete: "CASCADE",
|
|
|
|
onUpdate: "RESTRICT",
|
|
|
|
})
|
|
|
|
equipment?: equipment;
|
2025-05-24 13:51:38 +02:00
|
|
|
|
2025-05-28 18:30:00 +02:00
|
|
|
@ManyToOne(() => vehicle, {
|
|
|
|
nullable: true,
|
|
|
|
onDelete: "CASCADE",
|
|
|
|
onUpdate: "RESTRICT",
|
|
|
|
})
|
|
|
|
vehicle?: vehicle;
|
2025-05-24 13:51:38 +02:00
|
|
|
|
|
|
|
@OneToMany(() => inspectionVersionedPlan, (ivp) => ivp.inspectionPlan, {
|
|
|
|
cascade: ["insert"],
|
|
|
|
})
|
|
|
|
versionedPlans: inspectionVersionedPlan[];
|
|
|
|
|
|
|
|
latestVersionedPlan?: inspectionVersionedPlan;
|
|
|
|
}
|