import { Entity, Column, JoinColumn, ManyToOne, OneToMany } from "typeorm"; import { EntityBase } from "./base/Base"; import { CommandSys } from "./CommandSys"; 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; @OneToMany(() => Command, (command) => command.commandSalary) commands: Command[]; } export class CreateCommandSalary { @Column() name: string; @Column() isActive: boolean; @Column() commandSysId: string; } export type UpdateCommandSalary = Partial;