import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; import { EntityBase } from "./base/Base"; import { Profile } from "./Profile"; import { ProfileEducationHistory } from "./ProfileEducationHistory"; import { ProfileEmployee } from "./ProfileEmployee"; @Entity("profileEducation") export class ProfileEducation extends EntityBase { @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง Profile", default: null, }) profileId: string; @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; @Column({ nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง ProfileEmployee", default: null, }) profileEmployeeId: string; @OneToMany( () => ProfileEducationHistory, (profileEducationHistory) => profileEducationHistory.histories, ) profileEducationHistories: ProfileEducationHistory[]; @ManyToOne(() => Profile, (profile) => profile.profileEducations) @JoinColumn({ name: "profileId" }) profile: Profile; @ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileEducations) @JoinColumn({ name: "profileEmployeeId" }) profileEmployee: ProfileEmployee; } export class CreateProfileEducation { profileId: string | null; country: string | null; degree: string | null; duration: string | null; durationYear: number; field: string | null; finishDate: Date | null; fundName: string | null; gpa: string | null; institute: string | null; other: string | null; startDate: Date | null; endDate: Date | null; educationLevel: string | null; educationLevelId: string | null; positionPath: string | null; positionPathId: string | null; isDate: boolean | null; isEducation: boolean | null; note: string | null; } export type UpdateProfileEducation = { country?: string | null; degree?: string | null; duration?: string | null; durationYear?: number; field?: string | null; finishDate?: Date | null; fundName?: string | null; gpa?: string | null; institute?: string | null; other?: string | null; startDate?: Date | null; endDate?: Date | null; educationLevel?: string | null; educationLevelId?: string | null; positionPath?: string | null; positionPathId?: string | null; isDate?: boolean | null; isEducation?: boolean | null; note?: string | null; };