import { Entity, Column, ManyToOne, JoinColumn } from "typeorm"; import { EntityBase } from "./base/Base"; import { Profile } from "./Profile"; import { ProfileAssessment } from "./ProfileAssessment"; @Entity("profileAssessmentHistory") export class ProfileAssessmentHistory extends EntityBase { @Column({ comment: "สถานะการใช้งาน", default: false, }) isActive: boolean; @Column({ nullable: true, comment: "ชื่อแบบประเมิน", type: "text", default: null, }) name: string; @Column({ nullable: true, type: "datetime", comment: "วันที่ได้รับ", default: null, }) date: Date; @Column({ nullable: true, type: "double", comment: "ผลประเมินส่วนที่1 (คะแนน)", default: null, }) point1: number; @Column({ nullable: true, type: "double", comment: "ส่วนที่1 (คะแนน)", default: null, }) point1Total: number; @Column({ nullable: true, type: "double", comment: "ผลประเมินส่วนที่2 (คะแนน)", default: null, }) point2: number; @Column({ nullable: true, type: "double", comment: "ส่วนที่2 (คะแนน)", default: null, }) point2Total: number; @Column({ nullable: true, type: "double", comment: "ผลประเมินรวม (คะแนน)", default: null, }) pointSum: number; @Column({ nullable: true, type: "double", comment: "ผลรวม (คะแนน)", default: null, }) pointSumTotal: number; @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง ProfileAssessment", default: null, }) profileAssessmentId: string; @ManyToOne(() => ProfileAssessment, (profileAssessment) => profileAssessment.profileAssessmentHistorys) @JoinColumn({ name: "profileAssessmentId" }) histories: ProfileAssessment; } export class CreateProfileAssessmentHistory { @Column() isActive: boolean; @Column() name: string | null; @Column() date: Date | null; @Column() point1: number | null; @Column() point1Total: number | null; @Column() point2: number | null; @Column() point2Total: number | null; @Column() pointSum: number | null; @Column() pointSumTotal: number | null; @Column("uuid") profileAssessmentId: string | null; } export type UpdateProfileAssessmentHistory = Partial;