add maintenance model, factory and service
This commit is contained in:
parent
cb60d61773
commit
0f6401953f
11 changed files with 276 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
|||
import { EquipmentViewModel } from "./equipment/equipment.models";
|
||||
import { MaintenanceViewModel } from "./maintenance.models";
|
||||
import { VehicleViewModel } from "./vehicle/vehicle.models";
|
||||
import { WearableViewModel } from "./wearable/wearable.models";
|
||||
|
||||
|
@ -21,12 +22,13 @@ export type DamageReportAssigned = {
|
|||
|
||||
export type DamageReportViewModel = {
|
||||
id: string;
|
||||
reported: Date;
|
||||
reportedAt: Date;
|
||||
status: string;
|
||||
done: boolean;
|
||||
description: string;
|
||||
imageCount: number;
|
||||
reportedBy: string;
|
||||
maintenance?: MaintenanceViewModel;
|
||||
} & DamageReportAssigned;
|
||||
|
||||
export interface CreateDamageReportViewModel {
|
||||
|
|
43
src/viewmodel/admin/unit/maintenance.models.ts
Normal file
43
src/viewmodel/admin/unit/maintenance.models.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
import { DamageReportViewModel } from "./damageReport.models";
|
||||
import { EquipmentViewModel } from "./equipment/equipment.models";
|
||||
import { VehicleViewModel } from "./vehicle/vehicle.models";
|
||||
import { WearableViewModel } from "./wearable/wearable.models";
|
||||
|
||||
export type MaintenanceAssigned = {
|
||||
relatedId: string;
|
||||
} & (
|
||||
| {
|
||||
assigned: "equipment";
|
||||
related: EquipmentViewModel;
|
||||
}
|
||||
| {
|
||||
assigned: "vehicle";
|
||||
related: VehicleViewModel;
|
||||
}
|
||||
| {
|
||||
assigned: "wearable";
|
||||
related: WearableViewModel;
|
||||
}
|
||||
);
|
||||
|
||||
export type MaintenanceViewModel = {
|
||||
id: string;
|
||||
createdAt: Date;
|
||||
status: string;
|
||||
done: boolean;
|
||||
description: string;
|
||||
reports: DamageReportViewModel[];
|
||||
} & MaintenanceAssigned;
|
||||
|
||||
export interface CreateMaintenanceViewModel {
|
||||
description: string;
|
||||
reportedBy: string;
|
||||
affectedId: string;
|
||||
affected: "equipment" | "vehicle" | "wearable";
|
||||
}
|
||||
|
||||
export interface UpdateMaintenanceViewModel {
|
||||
id: string;
|
||||
status: string;
|
||||
done: boolean;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue