db schema connects

This commit is contained in:
Julian Krauser 2025-05-28 17:06:45 +02:00
parent baa3b2cc8c
commit 8c81c8f336
7 changed files with 33 additions and 2 deletions

View file

@ -2,6 +2,7 @@ import { Column, ColumnType, Entity, ManyToOne, OneToMany, PrimaryGeneratedColum
import { getTypeByORM } from "../../../migrations/ormHelper";
import { equipmentType } from "./equipmentType";
import { damageReport } from "../damageReport";
import { inspection } from "../inspection/inspection";
@Entity()
export class equipment {
@ -35,4 +36,7 @@ export class equipment {
@OneToMany(() => damageReport, (d) => d.equipment, { cascade: ["insert"] })
reports: damageReport[];
@OneToMany(() => inspection, (i) => i.equipment)
inspections: inspection[];
}

View file

@ -1,5 +1,6 @@
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { equipment } from "./equipment";
import { inspectionPlan } from "../inspection/inspectionPlan";
@Entity()
export class equipmentType {
@ -15,5 +16,6 @@ export class equipmentType {
@OneToMany(() => equipment, (e) => e.equipmentType, { cascade: ["insert"] })
equipment: equipment[];
inspectionPlans: Array<any>;
@OneToMany(() => inspectionPlan, (ip) => ip.equipment)
inspectionPlans: inspectionPlan[];
}

View file

@ -22,6 +22,18 @@ export class inspection {
@Column({ type: getTypeByORM("date").type as ColumnType, nullable: true, default: null })
nextInspection?: Date;
@Column()
inspectionPlanId: string;
@Column()
inspectionVersionedPlanId: string;
@Column()
equipmentId: string;
@Column()
vehicleId: string;
@ManyToOne(() => inspectionPlan, {
nullable: false,
onDelete: "RESTRICT",

View file

@ -10,6 +10,12 @@ export class inspectionPointResult {
@Column({ type: "text" })
value: string;
@Column()
inspectionId: string;
@Column()
inspectionPointId: string;
@ManyToOne(() => inspection, {
nullable: false,
onDelete: "CASCADE",

View file

@ -2,6 +2,7 @@ import { Column, ColumnType, Entity, ManyToOne, OneToMany, PrimaryGeneratedColum
import { getTypeByORM } from "../../../migrations/ormHelper";
import { vehicleType } from "./vehicleType";
import { damageReport } from "../damageReport";
import { inspection } from "../inspection/inspection";
@Entity()
export class vehicle {
@ -35,4 +36,7 @@ export class vehicle {
@OneToMany(() => damageReport, (d) => d.vehicle, { cascade: ["insert"] })
reports: damageReport[];
@OneToMany(() => inspection, (i) => i.vehicle)
inspections: inspection[];
}

View file

@ -1,5 +1,6 @@
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { vehicle } from "./vehicle";
import { inspectionPlan } from "../inspection/inspectionPlan";
@Entity()
export class vehicleType {
@ -15,5 +16,6 @@ export class vehicleType {
@OneToMany(() => vehicle, (e) => e.vehicleType, { cascade: ["insert"] })
vehicle: vehicle[];
inspectionPlans: Array<any>;
@OneToMany(() => inspectionPlan, (ip) => ip.vehicle)
inspectionPlans: inspectionPlan[];
}

View file

@ -3,6 +3,7 @@ import { getTypeByORM } from "../../../migrations/ormHelper";
import { wearableType } from "./wearableType";
import { damageReport } from "../damageReport";
import { member } from "../../club/member/member";
import { inspection } from "../inspection/inspection";
@Entity()
export class wearable {