import { Entity, Column, ManyToOne, JoinColumn } 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; }