40 lines
950 B
TypeScript
40 lines
950 B
TypeScript
|
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
|
||
|
import { InspectionPointEnum } from "../../../enums/inspectionEnum";
|
||
|
import { inspectionVersionedPlan } from "./inspectionVersionedPlan";
|
||
|
|
||
|
@Entity()
|
||
|
export class inspectionPoint {
|
||
|
@PrimaryGeneratedColumn("uuid")
|
||
|
id: string;
|
||
|
|
||
|
@Column({ type: "varchar", length: 255 })
|
||
|
title: string;
|
||
|
|
||
|
@Column({ type: "text" })
|
||
|
description: string;
|
||
|
|
||
|
@Column({
|
||
|
type: "varchar",
|
||
|
length: 255,
|
||
|
transformer: {
|
||
|
to(value: InspectionPointEnum) {
|
||
|
return value.toString();
|
||
|
},
|
||
|
from(value: string) {
|
||
|
return InspectionPointEnum[value as keyof typeof InspectionPointEnum];
|
||
|
},
|
||
|
},
|
||
|
})
|
||
|
type: InspectionPointEnum;
|
||
|
|
||
|
@Column({ type: "int", default: 0 })
|
||
|
min: number;
|
||
|
|
||
|
@ManyToOne(() => inspectionVersionedPlan, {
|
||
|
nullable: false,
|
||
|
onDelete: "CASCADE",
|
||
|
onUpdate: "RESTRICT",
|
||
|
})
|
||
|
versionedPlan: inspectionVersionedPlan;
|
||
|
}
|