hrms-api-org/src/entities/OrgRevision.ts

81 lines
2.2 KiB
TypeScript
Raw Normal View History

2024-01-26 15:54:07 +07:00
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
2024-01-24 16:08:34 +07:00
import { EntityBase } from "./base/Base";
2024-01-26 15:54:07 +07:00
import { OrgRoot } from "./OrgRoot";
2024-01-31 14:29:39 +07:00
import { PosMaster } from "./PosMaster";
import { OrgChild1 } from "./OrgChild1";
import { OrgChild2 } from "./OrgChild2";
import { OrgChild3 } from "./OrgChild3";
import { OrgChild4 } from "./OrgChild4";
import { EmployeePosMaster } from "./EmployeePosMaster";
2024-01-24 16:08:34 +07:00
@Entity("orgRevision")
export class OrgRevision extends EntityBase {
@Column({
2024-02-01 14:17:56 +07:00
comment: "ชื่อของโครงสร้าง",
2024-01-24 16:08:34 +07:00
length: 255,
2024-02-01 11:02:35 +07:00
default: null,
2024-01-24 16:08:34 +07:00
})
orgRevisionName: string;
@Column({
2024-02-01 14:17:56 +07:00
comment: "สถานะเป็นโครงสร้างปัจจุบันหรือไม่",
default: false,
2024-01-24 16:08:34 +07:00
})
orgRevisionIsCurrent: boolean;
2024-01-24 16:08:34 +07:00
@Column({
nullable: true,
type: "datetime",
2024-02-01 14:17:56 +07:00
comment: "วันเวลาที่สร้างโครงสร้าง",
2024-02-01 11:02:35 +07:00
default: null,
2024-01-24 16:08:34 +07:00
})
orgRevisionCreatedAt: Date;
@Column({
nullable: true,
type: "datetime",
comment: "เวลาเผยแพร่",
2024-02-01 11:02:35 +07:00
default: null,
})
orgPublishDate: Date;
2024-01-24 16:08:34 +07:00
@Column({
2024-02-01 14:17:56 +07:00
comment: "สถานะเป็นโครงสร้างแบบร่างหรือไม่",
default: false,
2024-01-24 16:08:34 +07:00
})
orgRevisionIsDraft: boolean;
2024-01-26 10:13:07 +07:00
2024-01-31 14:29:39 +07:00
@OneToMany(() => PosMaster, (posMaster) => posMaster.orgRevision)
posMasters: PosMaster[];
@OneToMany(() => EmployeePosMaster, (employeePosMaster) => employeePosMaster.orgRevision)
employeePosMasters: EmployeePosMaster[];
2024-01-26 15:54:07 +07:00
@OneToMany(() => OrgRoot, (orgRoot) => orgRoot.orgRevision)
orgRoots: OrgRoot[];
2024-01-31 14:29:39 +07:00
@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[];
2024-01-24 16:08:34 +07:00
}
export class CreateOrgRevision {
@Column()
orgRevisionName: string;
@Column()
typeDraft: string;
2024-01-26 15:54:07 +07:00
@Column("uuid")
orgRevisionId?: string;
}
2024-01-24 16:08:34 +07:00
export type UpdateOrgRevision = Partial<OrgRevision>;