type safetiy

This commit is contained in:
Julian Krauser 2025-05-24 11:40:10 +02:00
parent 9b2ab1923e
commit 30baca2567
3 changed files with 37 additions and 9 deletions

View file

@ -6,7 +6,7 @@ import type { VehicleTypeViewModel } from "../vehicleType/vehicleType.models";
export type PlanTimeDefinition = `${number}-${"d" | "m" | "y"}` | `${number}/${number | "*"}`;
export interface InspectionPlanViewModel {
export type InspectionPlanViewModel = {
id: string;
title: string;
inspectionInterval: PlanTimeDefinition;
@ -16,7 +16,16 @@ export interface InspectionPlanViewModel {
inspectionPoints: InspectionPointViewModel[];
relatedId: string;
related: EquipmentTypeViewModel | VehicleTypeViewModel;
}
} & (
| {
assigned: "equipment";
related: EquipmentViewModel;
}
| {
assigned: "vehicle";
related: VehicleViewModel;
}
);
export interface InspectionVersionedPlanViewModel {
id: string;