pass reports to admin ui

This commit is contained in:
Julian Krauser 2025-07-16 12:42:54 +02:00
parent 41c3093754
commit 0fdb77d7ca
2 changed files with 13 additions and 3 deletions

View file

@ -25,12 +25,18 @@ export default abstract class DamageReportFactory {
assigned: "vehicle",
related: VehicleFactory.mapToSingle(record.vehicle),
};
} else {
} else if (record?.wearableId) {
assigned = {
relatedId: record.wearableId,
assigned: "wearable",
related: WearableFactory.mapToSingle(record.wearable),
};
} else {
assigned = {
relatedId: undefined,
assigned: undefined,
related: undefined,
};
}
return {
@ -39,7 +45,9 @@ export default abstract class DamageReportFactory {
status: record.status,
done: record.done,
description: record.description,
image: record.images,
location: record.location,
note: record.note,
images: record.images.filter((i) => !!i),
reportedBy: record?.reportedBy,
...assigned,
maintenance: record.maintenance ? MaintenanceFactory.mapToSingle(record.maintenance) : null,

View file

@ -26,7 +26,9 @@ export type DamageReportViewModel = {
status: string;
done: boolean;
description: string;
image: string[];
location: string;
note: string;
images: string[];
reportedBy: string;
maintenance?: MaintenanceViewModel;
} & DamageReportAssigned;