model clean and consistent naming
This commit is contained in:
parent
3ff44f7370
commit
0d8499b828
11 changed files with 59 additions and 64 deletions
|
@ -1,15 +1,15 @@
|
||||||
import { Check, Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
|
import { Check, Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
|
||||||
import { Equipment } from "./equipment/equipment";
|
import { equipment } from "./equipment/equipment";
|
||||||
import { Wearable } from "./wearable/wearable";
|
import { wearable } from "./wearable/wearable";
|
||||||
import { Vehicle } from "./vehicle/vehicle";
|
import { vehicle } from "./vehicle/vehicle";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class DamageReport {
|
export class damageReport {
|
||||||
@PrimaryGeneratedColumn("uuid")
|
@PrimaryGeneratedColumn("uuid")
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
@CreateDateColumn()
|
@CreateDateColumn()
|
||||||
reported: Date;
|
reportedAt: Date;
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255 })
|
@Column({ type: "varchar", length: 255 })
|
||||||
status: string;
|
status: string;
|
||||||
|
@ -29,24 +29,24 @@ export class DamageReport {
|
||||||
@Column({ nullable: true })
|
@Column({ nullable: true })
|
||||||
wearableId: string;
|
wearableId: string;
|
||||||
|
|
||||||
@ManyToOne(() => Equipment, {
|
@ManyToOne(() => equipment, {
|
||||||
nullable: true,
|
nullable: true,
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
onUpdate: "RESTRICT",
|
onUpdate: "RESTRICT",
|
||||||
})
|
})
|
||||||
equipment: Equipment;
|
equipment: equipment;
|
||||||
|
|
||||||
@ManyToOne(() => Vehicle, {
|
@ManyToOne(() => vehicle, {
|
||||||
nullable: true,
|
nullable: true,
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
onUpdate: "RESTRICT",
|
onUpdate: "RESTRICT",
|
||||||
})
|
})
|
||||||
vehicle: Vehicle;
|
vehicle: vehicle;
|
||||||
|
|
||||||
@ManyToOne(() => Wearable, {
|
@ManyToOne(() => wearable, {
|
||||||
nullable: true,
|
nullable: true,
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
onUpdate: "RESTRICT",
|
onUpdate: "RESTRICT",
|
||||||
})
|
})
|
||||||
wearable: Wearable;
|
wearable: wearable;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { Column, ColumnType, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
import { Column, ColumnType, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||||
import { getTypeByORM } from "../../../migrations/ormHelper";
|
import { getTypeByORM } from "../../../migrations/ormHelper";
|
||||||
import { EquipmentType } from "./equipmentType";
|
import { equipmentType } from "./equipmentType";
|
||||||
import { DamageReport } from "../damageReport";
|
import { damageReport } from "../damageReport";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class Equipment {
|
export class equipment {
|
||||||
@PrimaryGeneratedColumn("uuid")
|
@PrimaryGeneratedColumn("uuid")
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
@ -26,13 +26,13 @@ export class Equipment {
|
||||||
@Column()
|
@Column()
|
||||||
equipmentTypeId: string;
|
equipmentTypeId: string;
|
||||||
|
|
||||||
@ManyToOne(() => EquipmentType, {
|
@ManyToOne(() => equipmentType, {
|
||||||
nullable: false,
|
nullable: false,
|
||||||
onDelete: "RESTRICT",
|
onDelete: "RESTRICT",
|
||||||
onUpdate: "RESTRICT",
|
onUpdate: "RESTRICT",
|
||||||
})
|
})
|
||||||
equipmentType: EquipmentType;
|
equipmentType: equipmentType;
|
||||||
|
|
||||||
@OneToMany(() => DamageReport, (d) => d.equipment, { cascade: ["insert"] })
|
@OneToMany(() => damageReport, (d) => d.equipment, { cascade: ["insert"] })
|
||||||
reports: DamageReport[];
|
reports: damageReport[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||||
import { Equipment } from "./equipment";
|
import { equipment } from "./equipment";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class EquipmentType {
|
export class equipmentType {
|
||||||
@PrimaryGeneratedColumn("uuid")
|
@PrimaryGeneratedColumn("uuid")
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ export class EquipmentType {
|
||||||
@Column({ type: "text", nullable: true })
|
@Column({ type: "text", nullable: true })
|
||||||
description: string;
|
description: string;
|
||||||
|
|
||||||
@OneToMany(() => Equipment, (e) => e.equipmentType, { cascade: ["insert"] })
|
@OneToMany(() => equipment, (e) => e.equipmentType, { cascade: ["insert"] })
|
||||||
equipment: Equipment[];
|
equipment: equipment[];
|
||||||
|
|
||||||
inspectionPlans: Array<any>;
|
inspectionPlans: Array<any>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ import { Column, ColumnType, CreateDateColumn, Entity, ManyToOne, PrimaryGenerat
|
||||||
import { inspectionPlan } from "./inspectionPlan";
|
import { inspectionPlan } from "./inspectionPlan";
|
||||||
import { inspectionVersionedPlan } from "./inspectionVersionedPlan";
|
import { inspectionVersionedPlan } from "./inspectionVersionedPlan";
|
||||||
import { getTypeByORM } from "../../../migrations/ormHelper";
|
import { getTypeByORM } from "../../../migrations/ormHelper";
|
||||||
import { Vehicle } from "../vehicle/vehicle";
|
import { vehicle } from "../vehicle/vehicle";
|
||||||
import { Equipment } from "../equipment/equipment";
|
import { equipment } from "../equipment/equipment";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class inspection {
|
export class inspection {
|
||||||
|
@ -17,7 +17,7 @@ export class inspection {
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
|
|
||||||
@Column({ type: getTypeByORM("date").type as ColumnType, nullable: true })
|
@Column({ type: getTypeByORM("date").type as ColumnType, nullable: true })
|
||||||
finished?: Date;
|
finishedAt?: Date;
|
||||||
|
|
||||||
@Column({ type: getTypeByORM("date").type as ColumnType, nullable: true })
|
@Column({ type: getTypeByORM("date").type as ColumnType, nullable: true })
|
||||||
nextInspection?: Date;
|
nextInspection?: Date;
|
||||||
|
@ -28,9 +28,9 @@ export class inspection {
|
||||||
@ManyToOne(() => inspectionVersionedPlan)
|
@ManyToOne(() => inspectionVersionedPlan)
|
||||||
inspectionVersionedPlan: inspectionVersionedPlan;
|
inspectionVersionedPlan: inspectionVersionedPlan;
|
||||||
|
|
||||||
@ManyToOne(() => Equipment)
|
@ManyToOne(() => equipment)
|
||||||
equipment: Equipment;
|
equipment: equipment;
|
||||||
|
|
||||||
@ManyToOne(() => Vehicle)
|
@ManyToOne(() => vehicle)
|
||||||
vehicle: Vehicle;
|
vehicle: vehicle;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Column, CreateDateColumn, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
import { Column, CreateDateColumn, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||||
import { Equipment } from "../equipment/equipment";
|
import { equipment } from "../equipment/equipment";
|
||||||
import { Vehicle } from "../vehicle/vehicle";
|
import { vehicle } from "../vehicle/vehicle";
|
||||||
import { PlanTimeDefinition } from "../../../viewmodel/admin/unit/inspectionPlan/inspectionPlan.models";
|
import { PlanTimeDefinition } from "../../../viewmodel/admin/unit/inspectionPlan/inspectionPlan.models";
|
||||||
import { inspectionVersionedPlan } from "./inspectionVersionedPlan";
|
import { inspectionVersionedPlan } from "./inspectionVersionedPlan";
|
||||||
|
|
||||||
|
@ -27,11 +27,11 @@ export class inspectionPlan {
|
||||||
@Column()
|
@Column()
|
||||||
vehicleId: string;
|
vehicleId: string;
|
||||||
|
|
||||||
@ManyToOne(() => Equipment)
|
@ManyToOne(() => equipment)
|
||||||
equipment: Equipment;
|
equipment: equipment;
|
||||||
|
|
||||||
@ManyToOne(() => Vehicle)
|
@ManyToOne(() => vehicle)
|
||||||
vehicle: Vehicle;
|
vehicle: vehicle;
|
||||||
|
|
||||||
@OneToMany(() => inspectionVersionedPlan, (ivp) => ivp.inspectionPlan, {
|
@OneToMany(() => inspectionVersionedPlan, (ivp) => ivp.inspectionPlan, {
|
||||||
cascade: ["insert"],
|
cascade: ["insert"],
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
|
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
|
||||||
import { inspection } from "./inspection";
|
import { inspection } from "./inspection";
|
||||||
import { inspectionPoint } from "./inspectionPoint";
|
import { inspectionPoint } from "./inspectionPoint";
|
||||||
import { inspectionVersionedPlan } from "./inspectionVersionedPlan";
|
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class inspectionPointResult {
|
export class inspectionPointResult {
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
import { Column, CreateDateColumn, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn, Unique } from "typeorm";
|
import { Column, CreateDateColumn, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn, Unique } from "typeorm";
|
||||||
import { Equipment } from "../equipment/equipment";
|
|
||||||
import { Vehicle } from "../vehicle/vehicle";
|
|
||||||
import { PlanTimeDefinition } from "../../../viewmodel/admin/unit/inspectionPlan/inspectionPlan.models";
|
|
||||||
import { inspectionPlan } from "./inspectionPlan";
|
import { inspectionPlan } from "./inspectionPlan";
|
||||||
import { getTypeByORM } from "../../../migrations/ormHelper";
|
|
||||||
import { inspectionPoint } from "./inspectionPoint";
|
import { inspectionPoint } from "./inspectionPoint";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
|
@ -16,7 +12,7 @@ export class inspectionVersionedPlan {
|
||||||
version: number;
|
version: number;
|
||||||
|
|
||||||
@CreateDateColumn()
|
@CreateDateColumn()
|
||||||
created: Date;
|
createdAt: Date;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
inspectionPlanId: string;
|
inspectionPlanId: string;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { Column, ColumnType, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
import { Column, ColumnType, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||||
import { getTypeByORM } from "../../../migrations/ormHelper";
|
import { getTypeByORM } from "../../../migrations/ormHelper";
|
||||||
import { VehicleType } from "./vehicleType";
|
import { vehicleType } from "./vehicleType";
|
||||||
import { DamageReport } from "../damageReport";
|
import { damageReport } from "../damageReport";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class Vehicle {
|
export class vehicle {
|
||||||
@PrimaryGeneratedColumn("uuid")
|
@PrimaryGeneratedColumn("uuid")
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
@ -26,13 +26,13 @@ export class Vehicle {
|
||||||
@Column()
|
@Column()
|
||||||
vehicleTypeId: string;
|
vehicleTypeId: string;
|
||||||
|
|
||||||
@ManyToOne(() => VehicleType, {
|
@ManyToOne(() => vehicleType, {
|
||||||
nullable: false,
|
nullable: false,
|
||||||
onDelete: "RESTRICT",
|
onDelete: "RESTRICT",
|
||||||
onUpdate: "RESTRICT",
|
onUpdate: "RESTRICT",
|
||||||
})
|
})
|
||||||
vehicleType: VehicleType;
|
vehicleType: vehicleType;
|
||||||
|
|
||||||
@OneToMany(() => DamageReport, (d) => d.vehicle, { cascade: ["insert"] })
|
@OneToMany(() => damageReport, (d) => d.vehicle, { cascade: ["insert"] })
|
||||||
reports: DamageReport[];
|
reports: damageReport[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||||
import { Vehicle } from "./vehicle";
|
import { vehicle } from "./vehicle";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class VehicleType {
|
export class vehicleType {
|
||||||
@PrimaryGeneratedColumn("uuid")
|
@PrimaryGeneratedColumn("uuid")
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ export class VehicleType {
|
||||||
@Column({ type: "text", nullable: true })
|
@Column({ type: "text", nullable: true })
|
||||||
description: string;
|
description: string;
|
||||||
|
|
||||||
@OneToMany(() => Vehicle, (e) => e.vehicleType, { cascade: ["insert"] })
|
@OneToMany(() => vehicle, (e) => e.vehicleType, { cascade: ["insert"] })
|
||||||
equipment: Vehicle[];
|
vehicle: vehicle[];
|
||||||
|
|
||||||
inspectionPlans: Array<any>;
|
inspectionPlans: Array<any>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { Column, ColumnType, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
import { Column, ColumnType, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||||
import { getTypeByORM } from "../../../migrations/ormHelper";
|
import { getTypeByORM } from "../../../migrations/ormHelper";
|
||||||
import { WearableType } from "./wearableType";
|
import { wearableType } from "./wearableType";
|
||||||
import { DamageReport } from "../damageReport";
|
import { damageReport } from "../damageReport";
|
||||||
import { member } from "../../club/member/member";
|
import { member } from "../../club/member/member";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class Wearable {
|
export class wearable {
|
||||||
@PrimaryGeneratedColumn("uuid")
|
@PrimaryGeneratedColumn("uuid")
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
@ -25,17 +25,17 @@ export class Wearable {
|
||||||
decommissioned?: Date;
|
decommissioned?: Date;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
equipmentTypeId: string;
|
wearableTypeId: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
wearerId: string;
|
wearerId: string;
|
||||||
|
|
||||||
@ManyToOne(() => WearableType, {
|
@ManyToOne(() => wearableType, {
|
||||||
nullable: false,
|
nullable: false,
|
||||||
onDelete: "RESTRICT",
|
onDelete: "RESTRICT",
|
||||||
onUpdate: "RESTRICT",
|
onUpdate: "RESTRICT",
|
||||||
})
|
})
|
||||||
wearableType: WearableType;
|
wearableType: wearableType;
|
||||||
|
|
||||||
@ManyToOne(() => member, {
|
@ManyToOne(() => member, {
|
||||||
nullable: false,
|
nullable: false,
|
||||||
|
@ -44,6 +44,6 @@ export class Wearable {
|
||||||
})
|
})
|
||||||
wearer: member;
|
wearer: member;
|
||||||
|
|
||||||
@OneToMany(() => DamageReport, (d) => d.wearable, { cascade: ["insert"] })
|
@OneToMany(() => damageReport, (d) => d.wearable, { cascade: ["insert"] })
|
||||||
reports: DamageReport[];
|
reports: damageReport[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||||
import { Wearable } from "./wearable";
|
import { wearable as wearable } from "./wearable";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class WearableType {
|
export class wearableType {
|
||||||
@PrimaryGeneratedColumn("uuid")
|
@PrimaryGeneratedColumn("uuid")
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
@ -12,6 +12,6 @@ export class WearableType {
|
||||||
@Column({ type: "text", nullable: true })
|
@Column({ type: "text", nullable: true })
|
||||||
description: string;
|
description: string;
|
||||||
|
|
||||||
@OneToMany(() => Wearable, (e) => e.wearableType, { cascade: ["insert"] })
|
@OneToMany(() => wearable, (e) => e.wearableType, { cascade: ["insert"] })
|
||||||
equipment: Wearable[];
|
wearable: wearable[];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue