ff-admin-server/src/viewmodel/admin/unit/damageReport.models.ts

43 lines
947 B
TypeScript

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;
}