import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; import { EntityBase } from "./base/Base"; import { StateOperator } from "./StateOperator"; import { Workflow } from "./Workflow"; @Entity("state") export class State extends EntityBase { @Column({ nullable: true, comment: "ชื่อประเภทขั้นตอน", length: 255, default: null, }) name: string; @Column({ nullable: true, comment: "ประเภทขั้นตอน", length: 255, default: null, }) type: string; @Column({ nullable: true, comment: "ลำดับ", length: 255, default: null, }) order: string; @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง workflow", default: null, }) workflowId: string; @ManyToOne(() => Workflow, (workflow) => workflow.states) @JoinColumn({ name: "workflowId" }) workflow: Workflow; @OneToMany(() => StateOperator, (stateOperator) => stateOperator.state) stateOperators: StateOperator[]; }