extend wearable and enable maintenance
This commit is contained in:
parent
aeb1ccbc42
commit
b8b2186c58
20 changed files with 457 additions and 93 deletions
|
@ -5,6 +5,7 @@ import { getTypeByORM } from "../../../migrations/ormHelper";
|
|||
import { vehicle } from "../vehicle/vehicle";
|
||||
import { equipment } from "../equipment/equipment";
|
||||
import { inspectionPointResult } from "./inspectionPointResult";
|
||||
import { wearable } from "../wearable/wearable";
|
||||
|
||||
@Entity()
|
||||
export class inspection {
|
||||
|
@ -35,6 +36,9 @@ export class inspection {
|
|||
@Column({ nullable: true, default: null })
|
||||
vehicleId?: string;
|
||||
|
||||
@Column({ nullable: true, default: null })
|
||||
wearableId?: string;
|
||||
|
||||
@ManyToOne(() => inspectionPlan, {
|
||||
nullable: false,
|
||||
onDelete: "RESTRICT",
|
||||
|
@ -63,6 +67,13 @@ export class inspection {
|
|||
})
|
||||
vehicle: vehicle;
|
||||
|
||||
@ManyToOne(() => wearable, {
|
||||
nullable: true,
|
||||
onDelete: "CASCADE",
|
||||
onUpdate: "RESTRICT",
|
||||
})
|
||||
wearable: wearable;
|
||||
|
||||
@OneToMany(() => inspectionPointResult, (ipr) => ipr.inspection)
|
||||
pointResults: inspectionPointResult[];
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ import { PlanTimeDefinition } from "../../../viewmodel/admin/unit/inspection/ins
|
|||
import { inspectionVersionedPlan } from "./inspectionVersionedPlan";
|
||||
import { equipmentType } from "../equipment/equipmentType";
|
||||
import { vehicleType } from "../vehicle/vehicleType";
|
||||
import { wearableType } from "../wearable/wearableType";
|
||||
|
||||
@Entity()
|
||||
export class inspectionPlan {
|
||||
|
@ -27,6 +28,9 @@ export class inspectionPlan {
|
|||
@Column({ nullable: true, default: null })
|
||||
vehicleTypeId?: string;
|
||||
|
||||
@Column({ nullable: true, default: null })
|
||||
wearableTypeId?: string;
|
||||
|
||||
@ManyToOne(() => equipmentType, {
|
||||
nullable: true,
|
||||
onDelete: "CASCADE",
|
||||
|
@ -41,6 +45,13 @@ export class inspectionPlan {
|
|||
})
|
||||
vehicleType?: vehicleType;
|
||||
|
||||
@ManyToOne(() => wearableType, {
|
||||
nullable: true,
|
||||
onDelete: "CASCADE",
|
||||
onUpdate: "RESTRICT",
|
||||
})
|
||||
wearableType?: wearableType;
|
||||
|
||||
@OneToMany(() => inspectionVersionedPlan, (ivp) => ivp.inspectionPlan, {
|
||||
cascade: ["insert"],
|
||||
})
|
||||
|
|
|
@ -47,4 +47,7 @@ export class wearable {
|
|||
|
||||
@OneToMany(() => damageReport, (d) => d.wearable, { cascade: ["insert"] })
|
||||
reports: damageReport[];
|
||||
|
||||
@OneToMany(() => inspection, (i) => i.wearable)
|
||||
inspections: inspection[];
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { wearable as wearable } from "./wearable";
|
||||
import { inspectionPlan } from "../inspection/inspectionPlan";
|
||||
|
||||
@Entity()
|
||||
export class wearableType {
|
||||
|
@ -14,4 +15,7 @@ export class wearableType {
|
|||
|
||||
@OneToMany(() => wearable, (e) => e.wearableType, { cascade: ["insert"] })
|
||||
wearable: wearable[];
|
||||
|
||||
@OneToMany(() => inspectionPlan, (ip) => ip.wearableType)
|
||||
inspectionPlans: inspectionPlan[];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue