import { Entity, Column, OneToMany, ManyToMany, JoinTable } from "typeorm"; import { EntityBase } from "./base/Base"; import { KpiCapacityDetail } from "./kpiCapacityDetail"; import { KpiLink } from "./kpiLink"; import { KpiUserCapacity } from "./kpiUserCapacity"; enum CapacityType { HEAD = "HEAD", GROUP = "GROUP", EXECUTIVE = "EXECUTIVE", DIRECTOR = "DIRECTOR", INSPECTOR = "INSPECTOR", } @Entity("kpiCapacity") export class KpiCapacity extends EntityBase { @Column({ nullable: true, comment: "ประเภทสมรรถนะดังนี้ HEAD = สมรรถนะหลัก, GROUP = สมรรถนะประจำกลุ่ม, EXECUTIVE = สมรรถนะประจำผู้บริหารกรุงเทพมหานคร, " + "DIRECTOR = สมรรถนะเฉพาะสำหรับตำแหน่ง ผอ., INSPECTOR = สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการ", type: "enum", enum: CapacityType, default: null, }) type: CapacityType; @Column({ nullable: true, comment: "ชื่อสมรรถนะ", default: null, }) name: string; @Column({ nullable: true, type: "longtext", comment: "คำจำกัดความ", default: null, }) description: string; @OneToMany(() => KpiCapacityDetail, (kpiCapacityDetail) => kpiCapacityDetail.kpiCapacity) kpiCapacityDetails: KpiCapacityDetail[]; @ManyToMany(() => KpiLink, (kpiLink) => kpiLink.kpiCapacitys) @JoinTable() kpiLinks: KpiLink[]; @OneToMany(() => KpiUserCapacity, (kpiUserCapacity) => kpiUserCapacity.kpiCapacity) kpiUserCapacitys: KpiUserCapacity[]; } export class createKpiCapacity { @Column() type: string; @Column() name: string; @Column() description: string; } export class updateKpiCapacity { @Column() type: string; @Column() name: string; @Column() description: string; }