import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; import { EntityBase } from "./base/Base"; import { Profile } from "./Profile"; import { ProfileAssessmentHistory } from "./ProfileAssessmentHistory"; @Entity("profileAssessment") export class ProfileAssessment extends EntityBase { @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง Profile", default: null, }) profileId: string; @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; @OneToMany(() => ProfileAssessmentHistory, (profileAssessmentHistory) => profileAssessmentHistory.histories) profileAssessmentHistorys: ProfileAssessmentHistory[]; @ManyToOne(() => Profile, (profile) => profile.profileAssessments) @JoinColumn({ name: "profileId" }) profile: Profile; } export class CreateProfileAssessment { @Column("uuid") profileId: string | null; @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; } export type UpdateProfileAssessment = Partial;