import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; import { EntityBase } from "./base/Base"; import { KpiUserEvaluation } from "./kpiUserEvaluation"; import { KpiUserEvaluationReasonSpecial } from "./kpiUserEvaluationReasonSpecial"; @Entity("kpiUserSpecial") export class KpiUserSpecial extends EntityBase { @Column({ nullable: true, comment: "รอบ", default: null, }) period: string; @Column({ nullable: true, comment: "ปี", default: null, }) year: string; @Column({ nullable: true, comment: "รหัสตัวชี้วัด", default: null, }) including: string; @Column({ nullable: true, comment: "ชื่อตัวชี้วัด", default: null, }) includingName: string; @Column({ nullable: true, comment: "ค่าเป้าหมาย", default: null, }) target: string; @Column({ nullable: true, comment: "หน่วยนับ", default: null, }) unit: string; @Column({ nullable: true, comment: "น้ำหนัก", default: null, }) weight: number; @Column({ nullable: true, comment: "ระดับที่คาดหวัง", default: null, }) level: string; @Column({ nullable: true, comment: "ระดับคะแนน", default: null, }) point: number; @Column({ type: "double", nullable: true, default: null, comment: "ผลการประเมิน", }) summary: number; @Column({ nullable: true, comment: "ข้อมูลเอกสารหลักฐาน", default: null, }) documentInfoEvidence: string; @Column({ nullable: true, type: "datetime", comment: "ช่วงเวลาเริ่มเก็บข้อมูล", default: null, }) startDate: Date | null; @Column({ nullable: true, type: "datetime", comment: "ช่วงเวลาสิ้นสุดเก็บข้อมูล", default: null, }) endDate: Date | null; @Column({ nullable: true, comment: "ผลสำเร็จของงาน 1", default: null, }) achievement1: string; @Column({ nullable: true, comment: "ผลสำเร็จของงาน 2", default: null, }) achievement2: string; @Column({ nullable: true, comment: "ผลสำเร็จของงาน 3", default: null, }) achievement3: string; @Column({ nullable: true, comment: "ผลสำเร็จของงาน 4", default: null, }) achievement4: string; @Column({ nullable: true, comment: "ผลสำเร็จของงาน 5", default: null, }) achievement5: string; @Column({ type: "text", nullable: true, comment: "นิยามหรือความหมาย", default: null, }) meaning: string; @Column({ nullable: true, comment: "สูตรคำนวณ", default: null, }) formula: string; @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง kpiUserEvaluation", default: null, }) kpiUserEvaluationId: string; @ManyToOne(() => KpiUserEvaluation, (kpiUserEvaluation) => kpiUserEvaluation.kpiUserSpecials) @JoinColumn({ name: "kpiUserEvaluationId" }) kpiUserEvaluation: KpiUserEvaluation; @OneToMany( () => KpiUserEvaluationReasonSpecial, (kpiUserEvaluationReasonSpecial) => kpiUserEvaluationReasonSpecial.kpiUserSpecial, ) kpiUserEvaluationReasonSpecials: KpiUserEvaluationReasonSpecial[]; } export class CreateKpiUserSpecial { @Column() including: string | null; @Column() includingName: string | null; @Column() achievement1: string | null; @Column() achievement2: string | null; @Column() achievement3: string | null; @Column() achievement4: string | null; @Column() achievement5: string | null; @Column() target: string; @Column() unit: string | null; @Column() weight: number; @Column() meaning: string; @Column() formula: string; @Column("uuid") kpiUserEvaluationId: string; @Column() documentInfoEvidence: string; @Column({ nullable: true }) startDate?: Date | null; @Column({ nullable: true }) endDate?: Date | null; @Column() period: string; @Column() year: string; } export class UpdateKpiUserSpecial { @Column() including: string | null; @Column() includingName: string | null; @Column() achievement1: string | null; @Column() achievement2: string | null; @Column() achievement3: string | null; @Column() achievement4: string | null; @Column() achievement5: string | null; @Column() target: string; @Column() unit: string | null; @Column() weight: number; @Column() meaning: string; @Column() formula: string; @Column("uuid") kpiUserEvaluationId: string; @Column() documentInfoEvidence: string; @Column({ nullable: true }) startDate?: Date | null; @Column({ nullable: true }) endDate?: Date | null; @Column() period: string; @Column() year: string; } export class KpiUserSpecialDataPoint { id: string; point: number; summary: number; }