schema change and base operations

This commit is contained in:
Julian Krauser 2025-07-19 11:02:07 +02:00
parent 799a719012
commit 4d37571cb6
27 changed files with 660 additions and 52 deletions

View file

@ -1,8 +1,9 @@
import { Column, CreateDateColumn, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { Column, ColumnType, CreateDateColumn, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { equipment } from "./equipment/equipment";
import { wearable } from "./wearable/wearable";
import { vehicle } from "./vehicle/vehicle";
import { damageReport } from "./damageReport";
import { getTypeByORM } from "../../migrations/ormHelper";
@Entity()
export class maintenance {
@ -12,12 +13,12 @@ export class maintenance {
@CreateDateColumn()
createdAt: Date;
@Column({ type: getTypeByORM("datetime").type as ColumnType, nullable: true, default: null })
finishedAt?: Date;
@Column({ type: "varchar", length: 255 })
status: string;
@Column({ type: "boolean", default: false })
done: boolean;
@Column({ type: "text" })
description: string;
@ -50,7 +51,4 @@ export class maintenance {
onUpdate: "RESTRICT",
})
wearable?: wearable;
@OneToMany(() => damageReport, (dr) => dr.maintenance)
reports: damageReport[];
}