hrms-api-org/src/entities/OrgRevision.ts
2024-03-26 23:07:55 +07:00

80 lines
2.2 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { OrgRoot } from "./OrgRoot";
import { PosMaster } from "./PosMaster";
import { OrgChild1 } from "./OrgChild1";
import { OrgChild2 } from "./OrgChild2";
import { OrgChild3 } from "./OrgChild3";
import { OrgChild4 } from "./OrgChild4";
import { EmployeePosMaster } from "./EmployeePosMaster";
@Entity("orgRevision")
export class OrgRevision extends EntityBase {
@Column({
comment: "ชื่อของโครงสร้าง",
length: 255,
default: null,
})
orgRevisionName: string;
@Column({
comment: "สถานะเป็นโครงสร้างปัจจุบันหรือไม่",
default: false,
})
orgRevisionIsCurrent: boolean;
@Column({
nullable: true,
type: "datetime",
comment: "วันเวลาที่สร้างโครงสร้าง",
default: null,
})
orgRevisionCreatedAt: Date;
@Column({
nullable: true,
type: "datetime",
comment: "เวลาเผยแพร่",
default: null,
})
orgPublishDate: Date;
@Column({
comment: "สถานะเป็นโครงสร้างแบบร่างหรือไม่",
default: false,
})
orgRevisionIsDraft: boolean;
@OneToMany(() => PosMaster, (posMaster) => posMaster.orgRevision)
posMasters: PosMaster[];
@OneToMany(() => EmployeePosMaster, (employeePosMaster) => employeePosMaster.orgRevision)
employeePosMasters: EmployeePosMaster[];
@OneToMany(() => OrgRoot, (orgRoot) => orgRoot.orgRevision)
orgRoots: OrgRoot[];
@OneToMany(() => OrgChild1, (orgChild1) => orgChild1.orgRevision)
orgChild1s: OrgChild1[];
@OneToMany(() => OrgChild2, (orgChild2) => orgChild2.orgRevision)
orgChild2s: OrgChild2[];
@OneToMany(() => OrgChild3, (orgChild3) => orgChild3.orgRevision)
orgChild3s: OrgChild3[];
@OneToMany(() => OrgChild4, (orgChild4) => orgChild4.orgRevision)
orgChild4s: OrgChild4[];
}
export class CreateOrgRevision {
@Column()
orgRevisionName: string;
@Column()
typeDraft: string;
@Column("uuid")
orgRevisionId?: string;
}
export type UpdateOrgRevision = Partial<OrgRevision>;