import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; import { EntityBase } from "./base/Base"; import { Profile } from "./Profile"; import { ProfileEducationHistory } from "./ProfileEducationHistory"; @Entity("profileEducation") export class ProfileEducation extends EntityBase { @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง Profile", default: null, }) profileId: string; @Column({ comment: "สถานะการใช้งาน", default: false, }) isActive: boolean; @Column({ nullable: true, comment: "ประเทศ", length: 1000, default: null, }) country: string; @Column({ nullable: true, comment: "วุฒิการศึกษา", length: 200, default: null, }) degree: string; @Column({ nullable: true, comment: "ระยะเวลา", length: 1000, default: null, }) duration: string; @Column({ comment: "ระยะเวลาหลักสูตร", }) durationYear: number; @Column({ nullable: true, comment: "สาขาวิชา/ทาง", length: 200, default: null, }) field: string; @Column({ nullable: true, type: "datetime", comment: "วันที่สำเร็จการศึกษา", default: null, }) finishDate: Date; @Column({ nullable: true, comment: "ทุน", length: 1000, default: null, }) fundName: string; @Column({ nullable: true, comment: "เกรดเฉลี่ย", length: 20, default: null, }) gpa: string; @Column({ nullable: true, comment: "สถานศึกษา", length: 1000, default: null, }) institute: string; @Column({ nullable: true, comment: "ข้อมูลการติดต่อ", length: 1000, default: null, }) other: string; @Column({ nullable: true, type: "datetime", comment: "ตั้งแต่", default: null, }) startDate: Date; @Column({ nullable: true, type: "datetime", comment: "ถึง", default: null, }) endDate: Date; @Column({ nullable: true, comment: "ระดับศึกษา", type: "text", // ใช้ "text" แทน "string" เพื่อรองรับ long text default: null, }) educationLevel: string; @Column({ nullable: true, length: 40, comment: "Id ระดับศึกษา", default: null, }) educationLevelId: string; @Column({ nullable: true, comment: "เป็นวุฒิการศึกษาในตำแหน่ง", type: "text", default: null, }) positionPath: string; @Column({ nullable: true, comment: "หมายเหตุ", default: null, }) note: string; @Column({ nullable: true, length: 40, comment: "Id เป็นวุฒิการศึกษาในตำแหน่ง", default: null, }) positionPathId: string; @Column({ nullable: true, comment: "ประเภทช่วงเวลาการศึกษา", default: null, }) isDate: boolean; @Column({ nullable: true, comment: "เป็นวุฒิศึกษาในตำแหน่ง", default: null, }) isEducation: boolean; @OneToMany( () => ProfileEducationHistory, (profileEducationHistory) => profileEducationHistory.histories, ) profileEducationHistories: ProfileEducationHistory[]; @ManyToOne(() => Profile, (profile) => profile.profileEducations) @JoinColumn({ name: "profileId" }) profile: Profile; } export class CreateProfileEducation { @Column("uuid") profileId: string | null; @Column() isActive: boolean; @Column() country: string | null; @Column() degree: string | null; @Column() duration: string | null; @Column() durationYear: number; @Column() field: string | null; @Column() finishDate: Date | null; @Column() fundName: string | null; @Column() gpa: string | null; @Column() institute: string | null; @Column() other: string | null; @Column() startDate: Date | null; @Column() endDate: Date | null; @Column() educationLevel: string | null; @Column("uuid") educationLevelId: string | null; @Column() positionPath: string | null; @Column("uuid") positionPathId: string | null; @Column() isDate: boolean | null; @Column() isEducation: boolean | null; @Column() note: string | null; } export type UpdateProfileEducation = Partial;