import { Entity, Column, PrimaryGeneratedColumn, OneToMany, JoinColumn, } from "typeorm"; import { EntityBase } from "./base/Base"; import { AssignSkill } from "./AssignSkill"; export enum TypeSkill { COMPUTER = "computer", ENG = "english", INFORMATION = "information", RESOURSE = "resourse", } @Entity("skills") export class Skill extends EntityBase { @PrimaryGeneratedColumn() id: number; @Column({ nullable: false, type: "enum", enum: TypeSkill, comment: "หมวดหมู่ทักษะ", }) type: TypeSkill; @Column({ nullable: false, comment: "หัวข้อความรู้", }) title: string; @Column({ type: "text", nullable: true, comment: "คำอธิบายระดับความรู้ ระดับที่ 1", }) level1: string; @Column({ type: "text", nullable: true, comment: "คำอธิบายระดับความรู้ ระดับที่ 2", }) level2: string; @Column({ type: "text", nullable: true, comment: "คำอธิบายระดับความรู้ ระดับที่ 3", }) level3: string; @Column({ type: "text", nullable: true, comment: "คำอธิบายระดับความรู้ ระดับที่ 4", }) level4: string; @Column({ type: "text", nullable: true, comment: "คำอธิบายระดับความรู้ ระดับที่ 5", }) level5: string; @Column({ nullable: false, comment: "สถานะการใช้งาน 1 คือใช้งานปกติ, 0 คือไม่ใช้งาน", default: 1, }) active: number; @OneToMany( () => AssignSkill, (assignSkill: AssignSkill) => assignSkill.skill_id ) @JoinColumn({ name: "id" }) assignSkill: AssignSkill[]; }