hrms-api-org/src/entities/ProfileEducation.ts

245 lines
4.6 KiB
TypeScript
Raw Normal View History

2024-03-12 14:53:15 +07:00
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: "ระดับศึกษา",
2024-03-18 15:11:27 +07:00
type: "text", // ใช้ "text" แทน "string" เพื่อรองรับ long text
2024-03-12 14:53:15 +07:00
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;
2024-03-18 14:45:14 +07:00
@Column({
nullable: true,
comment: "หมายเหตุ",
default: null,
})
note: string;
2024-03-12 14:53:15 +07:00
@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;
2024-03-18 15:11:27 +07:00
@OneToMany(
() => ProfileEducationHistory,
(profileEducationHistory) => profileEducationHistory.histories,
)
2024-03-12 14:53:15 +07:00
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;
2024-03-18 15:11:17 +07:00
@Column()
note: string | null;
2024-03-12 14:53:15 +07:00
}
export type UpdateProfileEducation = Partial<CreateProfileEducation>;