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 { EquipmentViewModel } from "./equipment/equipment.models";
import type { VehicleViewModel } from "../vehicle/vehicle.models"; import type { MaintenanceViewModel } from "./maintenance.models";
import type { WearableViewModel } from "../wearable/wearable.models"; import type { VehicleViewModel } from "./vehicle/vehicle.models";
import type { WearableViewModel } from "./wearable/wearable.models";
export type DamageReportViewModel = { export type DamageReportAssigned = {
id: string;
reported: Date;
status: string;
done: boolean;
description: string;
providedImage: Array<string>;
relatedId: string; 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 { export interface CreateDamageReportViewModel {
description: string; description: string;
reportedBy: string;
affectedId: string; affectedId: string;
affected: "equipment" | "vehicle" | "wearable"; affected: "equipment" | "vehicle" | "wearable";
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,5 @@
import type { MemberViewModel } from "@/viewmodels/admin/club/member/member.models"; 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 { export interface WearableViewModel {
id: string; id: string;