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

50 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-09-24 16:42:24 +07:00
import { Entity, Column, JoinColumn, ManyToOne, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { CommandSys } from "./CommandSys";
2024-09-24 16:42:24 +07:00
import { Command } from "./Command";
@Entity("commandSalary")
export class CommandSalary extends EntityBase {
@Column({
nullable: true,
comment: "ชื่อคำสั่ง",
length: 255,
default: null,
})
name: string;
@Column({
comment: "สถานะการใช้งาน",
default: true,
})
isActive: boolean;
@Column({
nullable: true,
length: 255,
comment: "คีย์นอก(FK)ของตาราง CommandSys",
default: null,
})
commandSysId: string;
@ManyToOne(() => CommandSys, (commandSys) => commandSys.commandSalarys)
@JoinColumn({ name: "commandSysId" })
commandSalarySys: CommandSys;
2024-09-24 16:42:24 +07:00
@OneToMany(() => Command, (command) => command.commandSalary)
commands: Command[];
}
export class CreateCommandSalary {
@Column()
name: string;
@Column()
isActive: boolean;
@Column()
commandSysId: string;
}
export type UpdateCommandSalary = Partial<CreateCommandSalary>;