Compare commits
3 commits
d7a0ee694f
...
3ff44f7370
Author | SHA1 | Date | |
---|---|---|---|
3ff44f7370 | |||
95d1113ff9 | |||
15a511f942 |
25 changed files with 740 additions and 0 deletions
52
src/entity/unit/damageReport.ts
Normal file
52
src/entity/unit/damageReport.ts
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
import { Check, Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
|
||||||
|
import { Equipment } from "./equipment/equipment";
|
||||||
|
import { Wearable } from "./wearable/wearable";
|
||||||
|
import { Vehicle } from "./vehicle/vehicle";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class DamageReport {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@CreateDateColumn()
|
||||||
|
reported: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
status: string;
|
||||||
|
|
||||||
|
@Column({ type: "boolean", default: false })
|
||||||
|
done: boolean;
|
||||||
|
|
||||||
|
@Column({ type: "text" })
|
||||||
|
description: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
equipmentId: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
vehicleId: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
wearableId: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => Equipment, {
|
||||||
|
nullable: true,
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
onUpdate: "RESTRICT",
|
||||||
|
})
|
||||||
|
equipment: Equipment;
|
||||||
|
|
||||||
|
@ManyToOne(() => Vehicle, {
|
||||||
|
nullable: true,
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
onUpdate: "RESTRICT",
|
||||||
|
})
|
||||||
|
vehicle: Vehicle;
|
||||||
|
|
||||||
|
@ManyToOne(() => Wearable, {
|
||||||
|
nullable: true,
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
onUpdate: "RESTRICT",
|
||||||
|
})
|
||||||
|
wearable: Wearable;
|
||||||
|
}
|
38
src/entity/unit/equipment/equipment.ts
Normal file
38
src/entity/unit/equipment/equipment.ts
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
import { Column, ColumnType, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||||
|
import { getTypeByORM } from "../../../migrations/ormHelper";
|
||||||
|
import { EquipmentType } from "./equipmentType";
|
||||||
|
import { DamageReport } from "../damageReport";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class Equipment {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true, unique: true })
|
||||||
|
code?: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
location: string;
|
||||||
|
|
||||||
|
@Column({ type: getTypeByORM("datetime").type as ColumnType })
|
||||||
|
commissioned: Date;
|
||||||
|
|
||||||
|
@Column({ type: getTypeByORM("datetime").type as ColumnType, nullable: true })
|
||||||
|
decommissioned?: Date;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
equipmentTypeId: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => EquipmentType, {
|
||||||
|
nullable: false,
|
||||||
|
onDelete: "RESTRICT",
|
||||||
|
onUpdate: "RESTRICT",
|
||||||
|
})
|
||||||
|
equipmentType: EquipmentType;
|
||||||
|
|
||||||
|
@OneToMany(() => DamageReport, (d) => d.equipment, { cascade: ["insert"] })
|
||||||
|
reports: DamageReport[];
|
||||||
|
}
|
19
src/entity/unit/equipment/equipmentType.ts
Normal file
19
src/entity/unit/equipment/equipmentType.ts
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||||
|
import { Equipment } from "./equipment";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class EquipmentType {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
type: string;
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
description: string;
|
||||||
|
|
||||||
|
@OneToMany(() => Equipment, (e) => e.equipmentType, { cascade: ["insert"] })
|
||||||
|
equipment: Equipment[];
|
||||||
|
|
||||||
|
inspectionPlans: Array<any>;
|
||||||
|
}
|
36
src/entity/unit/inspection/inspection.ts
Normal file
36
src/entity/unit/inspection/inspection.ts
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
import { Column, ColumnType, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
|
||||||
|
import { inspectionPlan } from "./inspectionPlan";
|
||||||
|
import { inspectionVersionedPlan } from "./inspectionVersionedPlan";
|
||||||
|
import { getTypeByORM } from "../../../migrations/ormHelper";
|
||||||
|
import { Vehicle } from "../vehicle/vehicle";
|
||||||
|
import { Equipment } from "../equipment/equipment";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class inspection {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({ type: "text" })
|
||||||
|
context: string;
|
||||||
|
|
||||||
|
@CreateDateColumn()
|
||||||
|
createdAt: Date;
|
||||||
|
|
||||||
|
@Column({ type: getTypeByORM("date").type as ColumnType, nullable: true })
|
||||||
|
finished?: Date;
|
||||||
|
|
||||||
|
@Column({ type: getTypeByORM("date").type as ColumnType, nullable: true })
|
||||||
|
nextInspection?: Date;
|
||||||
|
|
||||||
|
@ManyToOne(() => inspectionPlan)
|
||||||
|
inspectionPlan: inspectionPlan;
|
||||||
|
|
||||||
|
@ManyToOne(() => inspectionVersionedPlan)
|
||||||
|
inspectionVersionedPlan: inspectionVersionedPlan;
|
||||||
|
|
||||||
|
@ManyToOne(() => Equipment)
|
||||||
|
equipment: Equipment;
|
||||||
|
|
||||||
|
@ManyToOne(() => Vehicle)
|
||||||
|
vehicle: Vehicle;
|
||||||
|
}
|
42
src/entity/unit/inspection/inspectionPlan.ts
Normal file
42
src/entity/unit/inspection/inspectionPlan.ts
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
import { Column, CreateDateColumn, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||||
|
import { Equipment } from "../equipment/equipment";
|
||||||
|
import { Vehicle } from "../vehicle/vehicle";
|
||||||
|
import { PlanTimeDefinition } from "../../../viewmodel/admin/unit/inspectionPlan/inspectionPlan.models";
|
||||||
|
import { inspectionVersionedPlan } from "./inspectionVersionedPlan";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class inspectionPlan {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
title: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
inspectionInterval: PlanTimeDefinition;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
remindTime: PlanTimeDefinition;
|
||||||
|
|
||||||
|
@CreateDateColumn()
|
||||||
|
created: Date;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
equipmentId: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
vehicleId: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => Equipment)
|
||||||
|
equipment: Equipment;
|
||||||
|
|
||||||
|
@ManyToOne(() => Vehicle)
|
||||||
|
vehicle: Vehicle;
|
||||||
|
|
||||||
|
@OneToMany(() => inspectionVersionedPlan, (ivp) => ivp.inspectionPlan, {
|
||||||
|
cascade: ["insert"],
|
||||||
|
})
|
||||||
|
versionedPlans: inspectionVersionedPlan[];
|
||||||
|
|
||||||
|
latestVersionedPlan?: inspectionVersionedPlan;
|
||||||
|
}
|
39
src/entity/unit/inspection/inspectionPoint.ts
Normal file
39
src/entity/unit/inspection/inspectionPoint.ts
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
|
||||||
|
import { InspectionPointEnum } from "../../../enums/inspectionEnum";
|
||||||
|
import { inspectionVersionedPlan } from "./inspectionVersionedPlan";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class inspectionPoint {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
title: string;
|
||||||
|
|
||||||
|
@Column({ type: "text" })
|
||||||
|
description: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
type: "varchar",
|
||||||
|
length: 255,
|
||||||
|
transformer: {
|
||||||
|
to(value: InspectionPointEnum) {
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
from(value: string) {
|
||||||
|
return InspectionPointEnum[value as keyof typeof InspectionPointEnum];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
type: InspectionPointEnum;
|
||||||
|
|
||||||
|
@Column({ type: "int", default: 0 })
|
||||||
|
min: number;
|
||||||
|
|
||||||
|
@ManyToOne(() => inspectionVersionedPlan, {
|
||||||
|
nullable: false,
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
onUpdate: "RESTRICT",
|
||||||
|
})
|
||||||
|
versionedPlan: inspectionVersionedPlan;
|
||||||
|
}
|
19
src/entity/unit/inspection/inspectionPointResult.ts
Normal file
19
src/entity/unit/inspection/inspectionPointResult.ts
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
|
||||||
|
import { inspection } from "./inspection";
|
||||||
|
import { inspectionPoint } from "./inspectionPoint";
|
||||||
|
import { inspectionVersionedPlan } from "./inspectionVersionedPlan";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class inspectionPointResult {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({ type: "text" })
|
||||||
|
value: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => inspection)
|
||||||
|
inspection: inspection;
|
||||||
|
|
||||||
|
@ManyToOne(() => inspectionPoint)
|
||||||
|
inspectionPoint: inspectionPoint;
|
||||||
|
}
|
35
src/entity/unit/inspection/inspectionVersionedPlan.ts
Normal file
35
src/entity/unit/inspection/inspectionVersionedPlan.ts
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
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()
|
||||||
|
@Unique("unique_version", ["version", "inspectionPlanId"])
|
||||||
|
export class inspectionVersionedPlan {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({ type: "int", default: 0 })
|
||||||
|
version: number;
|
||||||
|
|
||||||
|
@CreateDateColumn()
|
||||||
|
created: Date;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
inspectionPlanId: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => inspectionPlan, {
|
||||||
|
nullable: false,
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
onUpdate: "RESTRICT",
|
||||||
|
})
|
||||||
|
inspectionPlan: inspectionPlan;
|
||||||
|
|
||||||
|
@OneToMany(() => inspectionPoint, (ip) => ip.versionedPlan, {
|
||||||
|
cascade: ["insert"],
|
||||||
|
})
|
||||||
|
inspectionPoints: inspectionPoint[];
|
||||||
|
}
|
38
src/entity/unit/vehicle/vehicle.ts
Normal file
38
src/entity/unit/vehicle/vehicle.ts
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
import { Column, ColumnType, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||||
|
import { getTypeByORM } from "../../../migrations/ormHelper";
|
||||||
|
import { VehicleType } from "./vehicleType";
|
||||||
|
import { DamageReport } from "../damageReport";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class Vehicle {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true, unique: true })
|
||||||
|
code?: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
location: string;
|
||||||
|
|
||||||
|
@Column({ type: getTypeByORM("datetime").type as ColumnType })
|
||||||
|
commissioned: Date;
|
||||||
|
|
||||||
|
@Column({ type: getTypeByORM("datetime").type as ColumnType, nullable: true })
|
||||||
|
decommissioned?: Date;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
vehicleTypeId: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => VehicleType, {
|
||||||
|
nullable: false,
|
||||||
|
onDelete: "RESTRICT",
|
||||||
|
onUpdate: "RESTRICT",
|
||||||
|
})
|
||||||
|
vehicleType: VehicleType;
|
||||||
|
|
||||||
|
@OneToMany(() => DamageReport, (d) => d.vehicle, { cascade: ["insert"] })
|
||||||
|
reports: DamageReport[];
|
||||||
|
}
|
19
src/entity/unit/vehicle/vehicleType.ts
Normal file
19
src/entity/unit/vehicle/vehicleType.ts
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||||
|
import { Vehicle } from "./vehicle";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class VehicleType {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
type: string;
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
description: string;
|
||||||
|
|
||||||
|
@OneToMany(() => Vehicle, (e) => e.vehicleType, { cascade: ["insert"] })
|
||||||
|
equipment: Vehicle[];
|
||||||
|
|
||||||
|
inspectionPlans: Array<any>;
|
||||||
|
}
|
49
src/entity/unit/wearable/wearable.ts
Normal file
49
src/entity/unit/wearable/wearable.ts
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
import { Column, ColumnType, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||||
|
import { getTypeByORM } from "../../../migrations/ormHelper";
|
||||||
|
import { WearableType } from "./wearableType";
|
||||||
|
import { DamageReport } from "../damageReport";
|
||||||
|
import { member } from "../../club/member/member";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class Wearable {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true, unique: true })
|
||||||
|
code?: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
location: string;
|
||||||
|
|
||||||
|
@Column({ type: getTypeByORM("datetime").type as ColumnType })
|
||||||
|
commissioned: Date;
|
||||||
|
|
||||||
|
@Column({ type: getTypeByORM("datetime").type as ColumnType, nullable: true })
|
||||||
|
decommissioned?: Date;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
equipmentTypeId: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
wearerId: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => WearableType, {
|
||||||
|
nullable: false,
|
||||||
|
onDelete: "RESTRICT",
|
||||||
|
onUpdate: "RESTRICT",
|
||||||
|
})
|
||||||
|
wearableType: WearableType;
|
||||||
|
|
||||||
|
@ManyToOne(() => member, {
|
||||||
|
nullable: false,
|
||||||
|
onDelete: "SET NULL",
|
||||||
|
onUpdate: "RESTRICT",
|
||||||
|
})
|
||||||
|
wearer: member;
|
||||||
|
|
||||||
|
@OneToMany(() => DamageReport, (d) => d.wearable, { cascade: ["insert"] })
|
||||||
|
reports: DamageReport[];
|
||||||
|
}
|
17
src/entity/unit/wearable/wearableType.ts
Normal file
17
src/entity/unit/wearable/wearableType.ts
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||||
|
import { Wearable } from "./wearable";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class WearableType {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
type: string;
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
description: string;
|
||||||
|
|
||||||
|
@OneToMany(() => Wearable, (e) => e.wearableType, { cascade: ["insert"] })
|
||||||
|
equipment: Wearable[];
|
||||||
|
}
|
5
src/enums/inspectionEnum.ts
Normal file
5
src/enums/inspectionEnum.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
export enum InspectionPointEnum {
|
||||||
|
oknok = "oknok",
|
||||||
|
text = "text",
|
||||||
|
number = "number",
|
||||||
|
}
|
38
src/viewmodel/admin/unit/damageReport/damageReport.models.ts
Normal file
38
src/viewmodel/admin/unit/damageReport/damageReport.models.ts
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
import type { EquipmentViewModel } from "../equipment/equipment.models";
|
||||||
|
import type { VehicleViewModel } from "../vehicle/vehicle.models";
|
||||||
|
import type { WearableViewModel } from "../wearable/wearable.models";
|
||||||
|
|
||||||
|
export type DamageReportViewModel = {
|
||||||
|
id: string;
|
||||||
|
reported: Date;
|
||||||
|
status: string;
|
||||||
|
done: boolean;
|
||||||
|
description: string;
|
||||||
|
providedImage: Array<string>;
|
||||||
|
relatedId: string;
|
||||||
|
} & (
|
||||||
|
| {
|
||||||
|
assigned: "equipment";
|
||||||
|
related: EquipmentViewModel;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
assigned: "vehicle";
|
||||||
|
related: VehicleViewModel;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
assigned: "wearable";
|
||||||
|
related: WearableViewModel;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
export interface CreateDamageReportViewModel {
|
||||||
|
description: string;
|
||||||
|
affectedId: string;
|
||||||
|
affected: "equipment" | "vehicle" | "wearable";
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateDamageReportViewModel {
|
||||||
|
id: string;
|
||||||
|
status: string;
|
||||||
|
done: boolean;
|
||||||
|
}
|
31
src/viewmodel/admin/unit/equipment/equipment.models.ts
Normal file
31
src/viewmodel/admin/unit/equipment/equipment.models.ts
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
import type { EquipmentTypeViewModel } from "../equipmentType/equipmentType.models";
|
||||||
|
import type { InspectionViewModel } from "../inspection/inspection.models";
|
||||||
|
|
||||||
|
export interface EquipmentViewModel {
|
||||||
|
id: string;
|
||||||
|
code?: string;
|
||||||
|
name: string;
|
||||||
|
location: string;
|
||||||
|
commissioned: Date;
|
||||||
|
decommissioned?: Date;
|
||||||
|
equipmentTypeId: string;
|
||||||
|
equipmentType: EquipmentTypeViewModel;
|
||||||
|
inspections: Array<InspectionViewModel>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateEquipmentViewModel {
|
||||||
|
code?: string;
|
||||||
|
name: string;
|
||||||
|
location: string;
|
||||||
|
commissioned: Date;
|
||||||
|
equipmentTypeId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateEquipmentViewModel {
|
||||||
|
id: string;
|
||||||
|
code?: string;
|
||||||
|
name: string;
|
||||||
|
location: string;
|
||||||
|
commissioned: Date;
|
||||||
|
decommissioned?: Date;
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
import type { InspectionPlanViewModel } from "../inspectionPlan/inspectionPlan.models";
|
||||||
|
|
||||||
|
export interface EquipmentTypeViewModel {
|
||||||
|
id: string;
|
||||||
|
type: string;
|
||||||
|
description: string;
|
||||||
|
inspectionPlans: Array<InspectionPlanViewModel>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateEquipmentTypeViewModel {
|
||||||
|
type: string;
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateEquipmentTypeViewModel {
|
||||||
|
id: string;
|
||||||
|
type: string;
|
||||||
|
description: string;
|
||||||
|
}
|
37
src/viewmodel/admin/unit/inspection/inspection.models.ts
Normal file
37
src/viewmodel/admin/unit/inspection/inspection.models.ts
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
import type { EquipmentViewModel } from "../equipment/equipment.models";
|
||||||
|
import type {
|
||||||
|
InspectionPlanViewModel,
|
||||||
|
InspectionVersionedPlanViewModel,
|
||||||
|
} from "../inspectionPlan/inspectionPlan.models";
|
||||||
|
import type { VehicleViewModel } from "../vehicle/vehicle.models";
|
||||||
|
|
||||||
|
export type InspectionViewModel = {
|
||||||
|
id: string;
|
||||||
|
inspectionPlanId: string;
|
||||||
|
inspectionPlan: InspectionPlanViewModel;
|
||||||
|
inspectionVersionedPlanId: string;
|
||||||
|
inspectionVersionedPlan: InspectionVersionedPlanViewModel;
|
||||||
|
context: string;
|
||||||
|
created: Date;
|
||||||
|
finished?: Date;
|
||||||
|
isOpen: boolean;
|
||||||
|
nextInspection?: Date;
|
||||||
|
checks: Array<InspectionPointResultViewModel>;
|
||||||
|
relatedId: string;
|
||||||
|
} & (
|
||||||
|
| {
|
||||||
|
assigned: "equipment";
|
||||||
|
related: EquipmentViewModel;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
assigned: "vehicle";
|
||||||
|
related: VehicleViewModel;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
export interface InspectionPointResultViewModel {
|
||||||
|
inspectionId: string;
|
||||||
|
inspectionVersionedPlanId: string;
|
||||||
|
inspectionPointId: string;
|
||||||
|
value: string;
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
import { InspectionPointEnum } from "../../../../enums/inspectionEnum";
|
||||||
|
import type { EquipmentViewModel } from "../equipment/equipment.models";
|
||||||
|
import type { VehicleViewModel } from "../vehicle/vehicle.models";
|
||||||
|
|
||||||
|
export type PlanTimeDefinition = `${number}-${"d" | "m" | "y"}` | `${number}/${number | "*"}`;
|
||||||
|
|
||||||
|
export type InspectionPlanViewModel = {
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
inspectionInterval: PlanTimeDefinition;
|
||||||
|
remindTime: PlanTimeDefinition;
|
||||||
|
version: number;
|
||||||
|
created: Date;
|
||||||
|
inspectionPoints: InspectionPointViewModel[];
|
||||||
|
relatedId: string;
|
||||||
|
} & (
|
||||||
|
| {
|
||||||
|
assigned: "equipment";
|
||||||
|
related: EquipmentViewModel;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
assigned: "vehicle";
|
||||||
|
related: VehicleViewModel;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
export interface InspectionVersionedPlanViewModel {
|
||||||
|
id: string;
|
||||||
|
version: number;
|
||||||
|
created: Date;
|
||||||
|
inspectionPoints: InspectionPointViewModel[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface InspectionPointViewModel {
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
type: InspectionPointEnum;
|
||||||
|
min?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateInspectionPlanViewModel {
|
||||||
|
title: string;
|
||||||
|
inspectionInterval: PlanTimeDefinition;
|
||||||
|
remindTime: PlanTimeDefinition;
|
||||||
|
relatedId: string;
|
||||||
|
assigned: "vehicle" | "equipment";
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateInspectionPlanViewModel {
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
inspectionInterval: PlanTimeDefinition;
|
||||||
|
remindTime?: PlanTimeDefinition;
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
import type { EquipmentViewModel } from "../equipment/equipment.models";
|
||||||
|
|
||||||
|
export interface RespiratoryGearViewModel {
|
||||||
|
id: string;
|
||||||
|
equipmentId: string;
|
||||||
|
equipment: EquipmentViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateRespiratoryGearViewModel {
|
||||||
|
equipmentId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateRespiratoryGearViewModel {
|
||||||
|
id: string;
|
||||||
|
equipmentId: string;
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
export interface RespiratoryMissionViewModel {
|
||||||
|
id: string;
|
||||||
|
date: Date;
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
// refs to used respiratory gear and wearers
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateRespiratoryMissionViewModel {
|
||||||
|
date: Date;
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateRespiratoryMissionViewModel {
|
||||||
|
id: string;
|
||||||
|
date: Date;
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { MemberViewModel } from "../../club/member/member.models";
|
||||||
|
|
||||||
|
export interface RespiratoryWearerViewModel {
|
||||||
|
id: string;
|
||||||
|
memberId: string;
|
||||||
|
member: MemberViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateRespiratoryWearerViewModel {
|
||||||
|
memberId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateRespiratoryWearerViewModel {
|
||||||
|
id: string;
|
||||||
|
memberId: string;
|
||||||
|
}
|
31
src/viewmodel/admin/unit/vehicle/vehicle.models.ts
Normal file
31
src/viewmodel/admin/unit/vehicle/vehicle.models.ts
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
import type { InspectionViewModel } from "../inspection/inspection.models";
|
||||||
|
import type { VehicleTypeViewModel } from "../vehicleType/vehicleType.models";
|
||||||
|
|
||||||
|
export interface VehicleViewModel {
|
||||||
|
id: string;
|
||||||
|
code?: string;
|
||||||
|
name: string;
|
||||||
|
location: string;
|
||||||
|
commissioned: Date;
|
||||||
|
decommissioned?: Date;
|
||||||
|
vehicleTypeId: string;
|
||||||
|
vehicleType: VehicleTypeViewModel;
|
||||||
|
inspections: Array<InspectionViewModel>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateVehicleViewModel {
|
||||||
|
code?: string;
|
||||||
|
name: string;
|
||||||
|
location: string;
|
||||||
|
commissioned: Date;
|
||||||
|
vehicleTypeId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateVehicleViewModel {
|
||||||
|
id: string;
|
||||||
|
code?: string;
|
||||||
|
name: string;
|
||||||
|
location: string;
|
||||||
|
commissioned: Date;
|
||||||
|
decommissioned?: Date;
|
||||||
|
}
|
19
src/viewmodel/admin/unit/vehicleType/vehicleType.models.ts
Normal file
19
src/viewmodel/admin/unit/vehicleType/vehicleType.models.ts
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import type { InspectionPlanViewModel } from "../inspectionPlan/inspectionPlan.models";
|
||||||
|
|
||||||
|
export interface VehicleTypeViewModel {
|
||||||
|
id: string;
|
||||||
|
type: string;
|
||||||
|
description: string;
|
||||||
|
inspectionPlans: Array<InspectionPlanViewModel>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateVehicleTypeViewModel {
|
||||||
|
type: string;
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateVehicleTypeViewModel {
|
||||||
|
id: string;
|
||||||
|
type: string;
|
||||||
|
description: string;
|
||||||
|
}
|
34
src/viewmodel/admin/unit/wearable/wearable.models.ts
Normal file
34
src/viewmodel/admin/unit/wearable/wearable.models.ts
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
import { MemberViewModel } from "../../club/member/member.models";
|
||||||
|
import type { WearableTypeViewModel } from "../wearableType/wearableType.models";
|
||||||
|
|
||||||
|
export interface WearableViewModel {
|
||||||
|
id: string;
|
||||||
|
code?: string;
|
||||||
|
name: string;
|
||||||
|
location: string;
|
||||||
|
commissioned: Date;
|
||||||
|
decommissioned?: Date;
|
||||||
|
wearerId?: string;
|
||||||
|
wearer?: MemberViewModel;
|
||||||
|
wearableTypeId: string;
|
||||||
|
wearableType: WearableTypeViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateWearableViewModel {
|
||||||
|
code?: string;
|
||||||
|
name: string;
|
||||||
|
wearerId?: string;
|
||||||
|
location?: string;
|
||||||
|
commissioned: Date;
|
||||||
|
wearableTypeId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateWearableViewModel {
|
||||||
|
id: string;
|
||||||
|
code?: string;
|
||||||
|
name: string;
|
||||||
|
location?: string;
|
||||||
|
commissioned: Date;
|
||||||
|
decommissioned?: Date;
|
||||||
|
wearerId?: string;
|
||||||
|
}
|
16
src/viewmodel/admin/unit/wearableType/wearableType.models.ts
Normal file
16
src/viewmodel/admin/unit/wearableType/wearableType.models.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
export interface WearableTypeViewModel {
|
||||||
|
id: string;
|
||||||
|
type: string;
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateWearableTypeViewModel {
|
||||||
|
type: string;
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateWearableTypeViewModel {
|
||||||
|
id: string;
|
||||||
|
type: string;
|
||||||
|
description: string;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue