model clean and consistent naming

This commit is contained in:
Julian Krauser 2025-05-25 07:01:13 +02:00
parent 3ff44f7370
commit 0d8499b828
11 changed files with 59 additions and 64 deletions

View file

@ -1,10 +1,10 @@
import { Column, ColumnType, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { getTypeByORM } from "../../../migrations/ormHelper";
import { EquipmentType } from "./equipmentType";
import { DamageReport } from "../damageReport";
import { equipmentType } from "./equipmentType";
import { damageReport } from "../damageReport";
@Entity()
export class Equipment {
export class equipment {
@PrimaryGeneratedColumn("uuid")
id: string;
@ -26,13 +26,13 @@ export class Equipment {
@Column()
equipmentTypeId: string;
@ManyToOne(() => EquipmentType, {
@ManyToOne(() => equipmentType, {
nullable: false,
onDelete: "RESTRICT",
onUpdate: "RESTRICT",
})
equipmentType: EquipmentType;
equipmentType: equipmentType;
@OneToMany(() => DamageReport, (d) => d.equipment, { cascade: ["insert"] })
reports: DamageReport[];
@OneToMany(() => damageReport, (d) => d.equipment, { cascade: ["insert"] })
reports: damageReport[];
}

View file

@ -1,8 +1,8 @@
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { Equipment } from "./equipment";
import { equipment } from "./equipment";
@Entity()
export class EquipmentType {
export class equipmentType {
@PrimaryGeneratedColumn("uuid")
id: string;
@ -12,8 +12,8 @@ export class EquipmentType {
@Column({ type: "text", nullable: true })
description: string;
@OneToMany(() => Equipment, (e) => e.equipmentType, { cascade: ["insert"] })
equipment: Equipment[];
@OneToMany(() => equipment, (e) => e.equipmentType, { cascade: ["insert"] })
equipment: equipment[];
inspectionPlans: Array<any>;
}