enable backups for unit

This commit is contained in:
Julian Krauser 2025-07-14 15:28:57 +02:00
parent 9a1bf6dfde
commit a69c3e048e
10 changed files with 85 additions and 21 deletions

View file

@ -30,37 +30,37 @@ export class damageReport {
@Column({ nullable: true, default: null })
equipmentId?: string;
@Column({ nullable: true, default: null })
maintenanceId?: string;
@Column({ nullable: true, default: null })
vehicleId?: string;
@Column({ nullable: true, default: null })
wearableId?: string;
@ManyToOne(() => equipment, {
@Column({ nullable: true, default: null })
maintenanceId?: string;
@ManyToOne(() => equipment, (e) => e.reports, {
nullable: true,
onDelete: "CASCADE",
onUpdate: "RESTRICT",
})
equipment?: equipment;
@ManyToOne(() => vehicle, {
@ManyToOne(() => vehicle, (v) => v.reports, {
nullable: true,
onDelete: "CASCADE",
onUpdate: "RESTRICT",
})
vehicle?: vehicle;
@ManyToOne(() => wearable, {
@ManyToOne(() => wearable, (w) => w.reports, {
nullable: true,
onDelete: "CASCADE",
onUpdate: "RESTRICT",
})
wearable?: wearable;
@ManyToOne(() => maintenance, {
@ManyToOne(() => maintenance, (m) => m.reports, {
nullable: true,
onDelete: "SET NULL",
onUpdate: "RESTRICT",

View file

@ -3,6 +3,7 @@ import { getTypeByORM } from "../../../migrations/ormHelper";
import { equipmentType } from "./equipmentType";
import { damageReport } from "../damageReport";
import { inspection } from "../inspection/inspection";
import { maintenance } from "../maintenance";
@Entity()
export class equipment {
@ -37,6 +38,9 @@ export class equipment {
@OneToMany(() => damageReport, (d) => d.equipment, { cascade: ["insert"] })
reports: damageReport[];
@OneToMany(() => inspection, (i) => i.equipment)
@OneToMany(() => maintenance, (m) => m.equipment, { cascade: ["insert"] })
maintenances: maintenance[];
@OneToMany(() => inspection, (i) => i.equipment, { cascade: ["insert"] })
inspections: inspection[];
}

View file

@ -16,7 +16,7 @@ export class equipmentType {
@OneToMany(() => equipment, (e) => e.equipmentType, { cascade: ["insert"] })
equipment: equipment[];
@OneToMany(() => inspectionPlan, (ip) => ip.equipmentType)
@OneToMany(() => inspectionPlan, (ip) => ip.equipmentType, { cascade: ["insert"] })
inspectionPlans: inspectionPlan[];
equipmentCount: number;

View file

@ -77,6 +77,6 @@ export class inspection {
})
wearable: wearable;
@OneToMany(() => inspectionPointResult, (ipr) => ipr.inspection)
@OneToMany(() => inspectionPointResult, (ipr) => ipr.inspection, { cascade: ["insert"] })
pointResults: inspectionPointResult[];
}

View file

@ -30,21 +30,21 @@ export class maintenance {
@Column({ nullable: true, default: null })
wearableId?: string;
@ManyToOne(() => equipment, {
@ManyToOne(() => equipment, (e) => e.maintenances, {
nullable: true,
onDelete: "CASCADE",
onUpdate: "RESTRICT",
})
equipment?: equipment;
@ManyToOne(() => vehicle, {
@ManyToOne(() => vehicle, (v) => v.maintenances, {
nullable: true,
onDelete: "CASCADE",
onUpdate: "RESTRICT",
})
vehicle?: vehicle;
@ManyToOne(() => wearable, {
@ManyToOne(() => wearable, (w) => w.maintenances, {
nullable: true,
onDelete: "CASCADE",
onUpdate: "RESTRICT",

View file

@ -3,6 +3,7 @@ import { getTypeByORM } from "../../../migrations/ormHelper";
import { vehicleType } from "./vehicleType";
import { damageReport } from "../damageReport";
import { inspection } from "../inspection/inspection";
import { maintenance } from "../maintenance";
@Entity()
export class vehicle {
@ -37,6 +38,9 @@ export class vehicle {
@OneToMany(() => damageReport, (d) => d.vehicle, { cascade: ["insert"] })
reports: damageReport[];
@OneToMany(() => inspection, (i) => i.vehicle)
@OneToMany(() => maintenance, (m) => m.vehicle, { cascade: ["insert"] })
maintenances: maintenance[];
@OneToMany(() => inspection, (i) => i.vehicle, { cascade: ["insert"] })
inspections: inspection[];
}

View file

@ -16,7 +16,7 @@ export class vehicleType {
@OneToMany(() => vehicle, (e) => e.vehicleType, { cascade: ["insert"] })
vehicle: vehicle[];
@OneToMany(() => inspectionPlan, (ip) => ip.vehicleType)
@OneToMany(() => inspectionPlan, (ip) => ip.vehicleType, { cascade: ["insert"] })
inspectionPlans: inspectionPlan[];
vehicleCount: number;

View file

@ -4,6 +4,7 @@ import { wearableType } from "./wearableType";
import { damageReport } from "../damageReport";
import { member } from "../../club/member/member";
import { inspection } from "../inspection/inspection";
import { maintenance } from "../maintenance";
@Entity()
export class wearable {
@ -48,6 +49,9 @@ export class wearable {
@OneToMany(() => damageReport, (d) => d.wearable, { cascade: ["insert"] })
reports: damageReport[];
@OneToMany(() => inspection, (i) => i.wearable)
@OneToMany(() => maintenance, (m) => m.wearable, { cascade: ["insert"] })
maintenances: maintenance[];
@OneToMany(() => inspection, (i) => i.wearable, { cascade: ["insert"] })
inspections: inspection[];
}

View file

@ -16,7 +16,7 @@ export class wearableType {
@OneToMany(() => wearable, (e) => e.wearableType, { cascade: ["insert"] })
wearable: wearable[];
@OneToMany(() => inspectionPlan, (ip) => ip.wearableType)
@OneToMany(() => inspectionPlan, (ip) => ip.wearableType, { cascade: ["insert"] })
inspectionPlans: inspectionPlan[];
wearableCount: number;