extend maintenance table
This commit is contained in:
parent
063b949ae1
commit
f05d03ccee
4 changed files with 34 additions and 1 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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) },
|
||||
|
|
|
@ -47,6 +47,8 @@ export type MinifiedInspectionViewModel = {
|
|||
created: Date;
|
||||
finished?: Date;
|
||||
isOpen: boolean;
|
||||
finishedAt?: Date;
|
||||
finishedBy?: string;
|
||||
nextInspection?: Date;
|
||||
relatedId: string;
|
||||
} & InspectionRelated;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue