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