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 })
|
@Column({ type: "varchar", length: 255 })
|
||||||
status: string;
|
status: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
title: string;
|
||||||
|
|
||||||
@Column({ type: "text" })
|
@Column({ type: "text" })
|
||||||
description: string;
|
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 })
|
@Column({ nullable: true, default: null })
|
||||||
equipmentId?: string;
|
equipmentId?: string;
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,10 @@ export default abstract class InspectionFactory {
|
||||||
inspectionPlan: InspectionPlanFactory.mapToSingle(record.inspectionPlan),
|
inspectionPlan: InspectionPlanFactory.mapToSingle(record.inspectionPlan),
|
||||||
context: record.context,
|
context: record.context,
|
||||||
created: record.createdAt,
|
created: record.createdAt,
|
||||||
finished: record?.finishedAt,
|
finishedAt: record?.finishedAt,
|
||||||
|
finishedBy: record?.finishedBy
|
||||||
|
? record.finishedBy.firstname + " " + record.finishedBy.lastname
|
||||||
|
: record.finishedByString,
|
||||||
isOpen: record?.finishedAt == undefined,
|
isOpen: record?.finishedAt == undefined,
|
||||||
nextInspection: record?.nextInspection,
|
nextInspection: record?.nextInspection,
|
||||||
...related,
|
...related,
|
||||||
|
|
|
@ -70,7 +70,11 @@ export const maintenance_table = new Table({
|
||||||
{ name: "finishedById", ...getTypeByORM("uuid", true) },
|
{ name: "finishedById", ...getTypeByORM("uuid", true) },
|
||||||
{ name: "finishedByString", ...getTypeByORM("varchar", true) },
|
{ name: "finishedByString", ...getTypeByORM("varchar", true) },
|
||||||
{ name: "status", ...getTypeByORM("varchar") },
|
{ name: "status", ...getTypeByORM("varchar") },
|
||||||
|
{ name: "title", ...getTypeByORM("varchar") },
|
||||||
{ name: "description", ...getTypeByORM("text") },
|
{ 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: "equipmentId", ...getTypeByORM("uuid", true) },
|
||||||
{ name: "vehicleId", ...getTypeByORM("uuid", true) },
|
{ name: "vehicleId", ...getTypeByORM("uuid", true) },
|
||||||
{ name: "wearableId", ...getTypeByORM("uuid", true) },
|
{ name: "wearableId", ...getTypeByORM("uuid", true) },
|
||||||
|
|
|
@ -47,6 +47,8 @@ export type MinifiedInspectionViewModel = {
|
||||||
created: Date;
|
created: Date;
|
||||||
finished?: Date;
|
finished?: Date;
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
|
finishedAt?: Date;
|
||||||
|
finishedBy?: string;
|
||||||
nextInspection?: Date;
|
nextInspection?: Date;
|
||||||
relatedId: string;
|
relatedId: string;
|
||||||
} & InspectionRelated;
|
} & InspectionRelated;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue