update models to backend changes

This commit is contained in:
Julian Krauser 2025-05-29 10:57:24 +02:00
parent ab3083c18d
commit bd1fdaa234
14 changed files with 79 additions and 29 deletions

View file

@ -0,0 +1,5 @@
export enum InspectionPointEnum {
oknok = "oknok",
text = "text",
number = "number",
}

View file

@ -1,14 +1,9 @@
import type { EquipmentViewModel } from "../equipment/equipment.models";
import type { VehicleViewModel } from "../vehicle/vehicle.models";
import type { WearableViewModel } from "../wearable/wearable.models";
import type { EquipmentViewModel } from "./equipment/equipment.models";
import type { MaintenanceViewModel } from "./maintenance.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>;
export type DamageReportAssigned = {
relatedId: string;
} & (
| {
@ -25,8 +20,20 @@ export type DamageReportViewModel = {
}
);
export type DamageReportViewModel = {
id: string;
reportedAt: Date;
status: string;
done: boolean;
description: string;
imageCount: number;
reportedBy: string;
maintenance?: MaintenanceViewModel;
} & DamageReportAssigned;
export interface CreateDamageReportViewModel {
description: string;
reportedBy: string;
affectedId: string;
affected: "equipment" | "vehicle" | "wearable";
}

View file

@ -1,5 +1,4 @@
import type { EquipmentTypeViewModel } from "../equipmentType/equipmentType.models";
import type { InspectionViewModel } from "../inspection/inspection.models";
import type { EquipmentTypeViewModel } from "./equipmentType.models";
export interface EquipmentViewModel {
id: string;
@ -10,7 +9,6 @@ export interface EquipmentViewModel {
decommissioned?: Date;
equipmentTypeId: string;
equipmentType: EquipmentTypeViewModel;
inspections: Array<InspectionViewModel>;
}
export interface CreateEquipmentViewModel {

View file

@ -1,10 +1,7 @@
import type { InspectionPlanViewModel } from "../inspectionPlan/inspectionPlan.models";
export interface EquipmentTypeViewModel {
id: string;
type: string;
description: string;
inspectionPlans: Array<InspectionPlanViewModel>;
}
export interface CreateEquipmentTypeViewModel {

View file

@ -1,8 +1,9 @@
import type { EquipmentViewModel } from "../equipment/equipment.models";
import type {
InspectionPlanViewModel,
InspectionPointViewModel,
InspectionVersionedPlanViewModel,
} from "../inspectionPlan/inspectionPlan.models";
} from "./inspectionPlan.models";
import type { VehicleViewModel } from "../vehicle/vehicle.models";
export type InspectionViewModel = {
@ -33,5 +34,6 @@ export interface InspectionPointResultViewModel {
inspectionId: string;
inspectionVersionedPlanId: string;
inspectionPointId: string;
inspectionPoint: InspectionPointViewModel;
value: string;
}

View file

@ -1,5 +1,6 @@
import type { EquipmentTypeViewModel } from "../equipmentType/equipmentType.models";
import type { VehicleTypeViewModel } from "../vehicleType/vehicleType.models";
import type { 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 | "*"}`;
@ -15,11 +16,11 @@ export type InspectionPlanViewModel = {
} & (
| {
assigned: "equipment";
related: EquipmentTypeViewModel;
related: EquipmentViewModel;
}
| {
assigned: "vehicle";
related: VehicleTypeViewModel;
related: VehicleViewModel;
}
);
@ -34,8 +35,10 @@ export interface InspectionPointViewModel {
id: string;
title: string;
description: string;
type: "iO-niO" | "text" | "number";
type: InspectionPointEnum;
min?: number;
max?: number;
sort: number;
}
export interface CreateInspectionPlanViewModel {

View file

@ -0,0 +1,43 @@
import type { DamageReportViewModel } from "./damageReport.models";
import type { EquipmentViewModel } from "./equipment/equipment.models";
import type { VehicleViewModel } from "./vehicle/vehicle.models";
import type { 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;
}

View file

@ -1,5 +1,4 @@
import type { InspectionViewModel } from "../inspection/inspection.models";
import type { VehicleTypeViewModel } from "../vehicleType/vehicleType.models";
import type { VehicleTypeViewModel } from "./vehicleType.models";
export interface VehicleViewModel {
id: string;
@ -10,7 +9,6 @@ export interface VehicleViewModel {
decommissioned?: Date;
vehicleTypeId: string;
vehicleType: VehicleTypeViewModel;
inspections: Array<InspectionViewModel>;
}
export interface CreateVehicleViewModel {

View file

@ -1,10 +1,7 @@
import type { InspectionPlanViewModel } from "../inspectionPlan/inspectionPlan.models";
export interface VehicleTypeViewModel {
id: string;
type: string;
description: string;
inspectionPlans: Array<InspectionPlanViewModel>;
}
export interface CreateVehicleTypeViewModel {

View file

@ -1,5 +1,5 @@
import type { MemberViewModel } from "@/viewmodels/admin/club/member/member.models";
import type { WearableTypeViewModel } from "../wearableType/wearableType.models";
import type { WearableTypeViewModel } from "./wearableType.models";
export interface WearableViewModel {
id: string;