2024-10-08 22:07:04 +07:00
|
|
|
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
|
|
|
|
import { EntityBase } from "./base/Base";
|
|
|
|
|
import { StateOperator } from "./StateOperator";
|
|
|
|
|
import { Workflow } from "./Workflow";
|
2024-10-16 11:55:45 +07:00
|
|
|
import { StateUserComment } from "./StateUserComment";
|
2024-10-08 22:07:04 +07:00
|
|
|
|
|
|
|
|
@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: "ลำดับ",
|
|
|
|
|
default: null,
|
|
|
|
|
})
|
2024-10-09 12:53:13 +07:00
|
|
|
order: number;
|
2024-10-08 22:07:04 +07:00
|
|
|
|
|
|
|
|
@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[];
|
2024-10-16 11:55:45 +07:00
|
|
|
|
|
|
|
|
@OneToMany(() => StateUserComment, (stateUserComment) => stateUserComment.state)
|
|
|
|
|
stateUserComments: StateUserComment[];
|
2024-10-08 22:07:04 +07:00
|
|
|
}
|