43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
|
import { Column, CreateDateColumn, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||
|
import { Equipment } from "../equipment/equipment";
|
||
|
import { Vehicle } from "../vehicle/vehicle";
|
||
|
import { PlanTimeDefinition } from "../../../viewmodel/admin/unit/inspectionPlan/inspectionPlan.models";
|
||
|
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()
|
||
|
created: Date;
|
||
|
|
||
|
@Column()
|
||
|
equipmentId: string;
|
||
|
|
||
|
@Column()
|
||
|
vehicleId: string;
|
||
|
|
||
|
@ManyToOne(() => Equipment)
|
||
|
equipment: Equipment;
|
||
|
|
||
|
@ManyToOne(() => Vehicle)
|
||
|
vehicle: Vehicle;
|
||
|
|
||
|
@OneToMany(() => inspectionVersionedPlan, (ivp) => ivp.inspectionPlan, {
|
||
|
cascade: ["insert"],
|
||
|
})
|
||
|
versionedPlans: inspectionVersionedPlan[];
|
||
|
|
||
|
latestVersionedPlan?: inspectionVersionedPlan;
|
||
|
}
|