import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm"; import { EntityBase } from "./base/Base"; import { KpiCapacity } from "./kpiCapacity"; import { KpiUserEvaluation } from "./kpiUserEvaluation"; import { KpiUserEvaluationReasonCapacity } from "./kpiUserEvaluationReasonCapacity"; @Entity("kpiUserCapacity") export class KpiUserCapacity extends EntityBase { @Column({ nullable: true, comment: "ระดับที่คาดหวัง", default: null, }) level: string; @Column({ nullable: true, comment: "น้ำหนัก", default: null, }) weight: number; @Column({ nullable: true, comment: "ระดับคะแนน", default: null, }) point: number; @Column({ type: "double", nullable: true, default: null, comment: "ผลการประเมิน", }) summary: number; @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง kpiUserEvaluation", default: null, }) kpiUserEvaluationId: string; @ManyToOne(() => KpiUserEvaluation, (kpiUserEvaluation) => kpiUserEvaluation.kpiUserCapacitys) @JoinColumn({ name: "kpiUserEvaluationId" }) kpiUserEvaluation: KpiUserEvaluation; @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง kpiCapacity", default: null, }) kpiCapacityId: string; @ManyToOne(() => KpiCapacity, (kpiCapacity) => kpiCapacity.kpiUserCapacitys) @JoinColumn({ name: "kpiCapacityId" }) kpiCapacity: KpiCapacity; @OneToMany( () => KpiUserEvaluationReasonCapacity, (kpiUserEvaluationReasonCapacity) => kpiUserEvaluationReasonCapacity.kpiUserCapacity, ) kpiUserEvaluationReasonCapacitys: KpiUserEvaluationReasonCapacity[]; } export class KpiUserCapacityDataPoint { id: string; point: number; }