inspection data model
This commit is contained in:
parent
95d1113ff9
commit
3ff44f7370
9 changed files with 222 additions and 21 deletions
39
src/entity/unit/inspection/inspectionPoint.ts
Normal file
39
src/entity/unit/inspection/inspectionPoint.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue