extend maintenance table

This commit is contained in:
Julian Krauser 2025-07-25 12:36:31 +02:00
parent 063b949ae1
commit f05d03ccee
4 changed files with 34 additions and 1 deletions

View file

@ -26,9 +26,33 @@ export class maintenance {
@Column({ type: "varchar", length: 255 })
status: string;
@Column({ type: "varchar", length: 255 })
title: string;
@Column({ type: "text" })
description: string;
@Column({ type: "varchar", length: 255, nullable: true, default: null })
responsible: string;
@Column({
type: "text",
nullable: true,
default: null,
transformer: {
from(value: string): Array<string> {
return (value ?? "").split(",").filter((i) => !!i);
},
to(value: Array<string> = []): string {
return value.join(",");
},
},
})
images: string[];
@Column({ type: "varchar", length: 255, nullable: true, default: null })
reportDocument?: string;
@Column({ nullable: true, default: null })
equipmentId?: string;

View file

@ -98,7 +98,10 @@ export default abstract class InspectionFactory {
inspectionPlan: InspectionPlanFactory.mapToSingle(record.inspectionPlan),
context: record.context,
created: record.createdAt,
finished: record?.finishedAt,
finishedAt: record?.finishedAt,
finishedBy: record?.finishedBy
? record.finishedBy.firstname + " " + record.finishedBy.lastname
: record.finishedByString,
isOpen: record?.finishedAt == undefined,
nextInspection: record?.nextInspection,
...related,

View file

@ -70,7 +70,11 @@ export const maintenance_table = new Table({
{ name: "finishedById", ...getTypeByORM("uuid", true) },
{ name: "finishedByString", ...getTypeByORM("varchar", true) },
{ name: "status", ...getTypeByORM("varchar") },
{ name: "title", ...getTypeByORM("varchar") },
{ name: "description", ...getTypeByORM("text") },
{ name: "responsible", ...getTypeByORM("varchar", true) },
{ name: "images", ...getTypeByORM("text", true) },
{ name: "reportDocument", ...getTypeByORM("varchar", true) },
{ name: "equipmentId", ...getTypeByORM("uuid", true) },
{ name: "vehicleId", ...getTypeByORM("uuid", true) },
{ name: "wearableId", ...getTypeByORM("uuid", true) },

View file

@ -47,6 +47,8 @@ export type MinifiedInspectionViewModel = {
created: Date;
finished?: Date;
isOpen: boolean;
finishedAt?: Date;
finishedBy?: string;
nextInspection?: Date;
relatedId: string;
} & InspectionRelated;