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

104 lines
2.3 KiB
TypeScript
Raw Normal View History

import { Entity, Column, JoinColumn, ManyToOne, OneToMany } from "typeorm";
2024-09-11 17:29:33 +07:00
import { EntityBase } from "./base/Base";
import { CommandType } from "./CommandType";
import { CommandSend } from "./CommandSend";
2024-09-11 17:29:33 +07:00
@Entity("command")
export class Command extends EntityBase {
// DRAFT = แบบร่าง
// PENDING = รอผู้มีอำนาจ
// WAITING = รอออกคำสั่ง
// REPORTED = ออกคำสั่งเสร็จสิ้น
// CANCEL = ยกเลิก
@Column({
nullable: true,
comment: "สถานะ",
length: 20,
default: null,
})
status: string;
@Column({
nullable: true,
comment: "คำสั่งเรื่อง",
length: 255,
default: null,
})
issue: string;
@Column({
nullable: true,
comment: "เลขที่คำสั่ง",
length: 255,
default: null,
})
commandNo: string;
@Column({
nullable: true,
comment: "ปี",
default: null,
})
commandYear: number;
@Column({
nullable: true,
type: "datetime",
comment: "วันที่ลงนาม",
default: null,
})
commandAffectDate: Date;
@Column({
nullable: true,
type: "datetime",
comment: "วันที่คำสั่งมีผล",
default: null,
})
commandExcecuteDate: Date;
@Column({
nullable: true,
comment: "เนื้อหาคำสั่งส่วนต้น",
type: "text",
default: null,
})
detailHeader: string;
@Column({
nullable: true,
comment: "เนื้อหาคำสั่งส่วนกลาง",
type: "text",
default: null,
})
detailBody: string;
@Column({
nullable: true,
comment: "เนื้อหาคำสั่งส่วนท้าย",
type: "text",
default: null,
})
detailFooter: string;
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง commandType",
})
commandTypeId: string;
@ManyToOne(() => CommandType, (commandType) => commandType.commands)
@JoinColumn({ name: "commandTypeId" })
commandType: CommandType;
@OneToMany(() => CommandSend, (commandSend) => commandSend.command)
commandSends: CommandSend[];
2024-09-11 17:29:33 +07:00
}
export class CreateCommand {
@Column()
name: string;
}
// export type UpdateCommand = Partial<CreateCommand>;