factory and restructure view models
This commit is contained in:
parent
fcbfe560c3
commit
117ced38ab
33 changed files with 479 additions and 46 deletions
43
src/viewmodel/admin/unit/damageReport.models.ts
Normal file
43
src/viewmodel/admin/unit/damageReport.models.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
import { EquipmentViewModel } from "./equipment/equipment.models";
|
||||
import { VehicleViewModel } from "./vehicle/vehicle.models";
|
||||
import { WearableViewModel } from "./wearable/wearable.models";
|
||||
|
||||
export type DamageReportAssigned = {
|
||||
relatedId: string;
|
||||
} & (
|
||||
| {
|
||||
assigned: "equipment";
|
||||
related: EquipmentViewModel;
|
||||
}
|
||||
| {
|
||||
assigned: "vehicle";
|
||||
related: VehicleViewModel;
|
||||
}
|
||||
| {
|
||||
assigned: "wearable";
|
||||
related: WearableViewModel;
|
||||
}
|
||||
);
|
||||
|
||||
export type DamageReportViewModel = {
|
||||
id: string;
|
||||
reported: Date;
|
||||
status: string;
|
||||
done: boolean;
|
||||
description: string;
|
||||
imageCount: number;
|
||||
reportedBy: string;
|
||||
} & DamageReportAssigned;
|
||||
|
||||
export interface CreateDamageReportViewModel {
|
||||
description: string;
|
||||
reportedBy: string;
|
||||
affectedId: string;
|
||||
affected: "equipment" | "vehicle" | "wearable";
|
||||
}
|
||||
|
||||
export interface UpdateDamageReportViewModel {
|
||||
id: string;
|
||||
status: string;
|
||||
done: boolean;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue