import { Entity, Column, ManyToOne, JoinColumn } from "typeorm"; import { EntityBase } from "./base/Base"; import { State } from "./State"; @Entity("stateOperator") export class StateOperator 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)ของตาราง state", default: null, }) stateId: string; @ManyToOne(() => State, (state) => state.stateOperators) @JoinColumn({ name: "stateId" }) state: State; }