migrate workflow

This commit is contained in:
kittapath 2024-10-11 10:47:15 +07:00
parent 2e406b14ab
commit 2af5598aae
3 changed files with 172 additions and 0 deletions

46
src/entities/MetaState.ts Normal file
View file

@ -0,0 +1,46 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { MetaStateOperator } from "./MetaStateOperator";
import { Workflow } from "./Workflow";
import { metaWorkflow } from "./MetaWorkflow";
@Entity("metaState")
export class MetaState 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,
})
order: number;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง metaWorkflow",
default: null,
})
metaWorkflowId: string;
@ManyToOne(() => metaWorkflow, (metaWorkflow) => metaWorkflow.metaStates)
@JoinColumn({ name: "metaWorkflowId" })
metaWorkflow: metaWorkflow;
@OneToMany(() => MetaStateOperator, (metaStateOperator) => metaStateOperator.metaState)
metaStateOperators: MetaStateOperator[];
}

View file

@ -0,0 +1,74 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { MetaState } from "./MetaState";
@Entity("metaStateOperator")
export class MetaStateOperator extends EntityBase {
@Column({
nullable: true,
comment: "ผู้ดำเนินการ",
length: 255,
default: null,
})
operator: string;
@Column({
comment: "ดูเอกสาร",
default: false,
})
canView: boolean;
@Column({
comment: "แก้ไขเอกสาร",
default: false,
})
canUpdate: boolean;
@Column({
comment: "ลบเอกสาร",
default: false,
})
canDelete: boolean;
@Column({
comment: "ยกเลิกเอกสาร",
default: false,
})
canCancel: boolean;
@Column({
comment: "ดำเนินการเอกสาร",
default: false,
})
canOperate: boolean;
@Column({
comment: "เปลี่ยนสถานะเอกสาร",
default: false,
})
canChangeState: boolean;
@Column({
comment: "แสดงความเห็นเอกสาร",
default: false,
})
canComment: boolean;
@Column({
comment: "ลงนามอนุมัติ",
default: false,
})
canSign: boolean;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง metaState",
default: null,
})
metaStateId: string;
@ManyToOne(() => MetaState, (metaState) => metaState.metaStateOperators)
@JoinColumn({ name: "metaStateId" })
metaState: MetaState;
}

View file

@ -0,0 +1,52 @@
import { Entity, Column, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { MetaState } from "./MetaState";
@Entity("metaWorkflow")
export class metaWorkflow extends EntityBase {
@Column({
nullable: true,
comment: "ชื่อ flow",
length: 255,
default: null,
})
name: string;
@Column({
nullable: true,
comment: "ระบบ", //PLACEMENT
length: 255,
default: null,
})
category: string;
@OneToMany(() => MetaState, (metaState) => metaState.metaWorkflow)
metaStates: MetaState[];
@Column({
nullable: true,
comment: "ชื่อระบบ", //สอบคัดเลือก
length: 100,
default: null,
})
sysName: string;
@Column({
nullable: true,
comment: "ชื่อระดับ",
length: 100,
default: null,
})
posLevelName: string;
@Column({
nullable: true,
comment: "ชื่อประเภท",
length: 100,
default: null,
})
posTypeName: string;
// @OneToMany(() => metaStateOperatorUser, (metaStateOperatorUser) => metaStateOperatorUser.metaWorkflow)
// metaStateOperatorUsers: metaStateOperatorUser[];
}