From f36ff656ef57ea23cdbaef232d3e6fc36378aa0a Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Tue, 12 Mar 2024 14:53:15 +0700 Subject: [PATCH] add entity org part 1 --- src/entities/Profile.ts | 26 ++- src/entities/ProfileAssessment.ts | 126 ++++++++++++ src/entities/ProfileAssessmentHistory.ts | 125 ++++++++++++ src/entities/ProfileCertificate.ts | 96 +++++++++ src/entities/ProfileCertificateHistory.ts | 94 +++++++++ src/entities/ProfileEducation.ts | 232 ++++++++++++++++++++++ src/entities/ProfileEducationHistory.ts | 232 ++++++++++++++++++++++ src/entities/ProfileHonor.ts | 103 ++++++++++ src/entities/ProfileHonorHistory.ts | 92 +++++++++ src/entities/ProfileInsignia.ts | 178 +++++++++++++++++ src/entities/ProfileInsigniaHistory.ts | 177 +++++++++++++++++ src/entities/ProfileTraining.ts | 157 +++++++++++++++ src/entities/ProfileTrainingHistory.ts | 146 ++++++++++++++ 13 files changed, 1783 insertions(+), 1 deletion(-) create mode 100644 src/entities/ProfileAssessment.ts create mode 100644 src/entities/ProfileAssessmentHistory.ts create mode 100644 src/entities/ProfileCertificate.ts create mode 100644 src/entities/ProfileCertificateHistory.ts create mode 100644 src/entities/ProfileEducation.ts create mode 100644 src/entities/ProfileEducationHistory.ts create mode 100644 src/entities/ProfileHonor.ts create mode 100644 src/entities/ProfileHonorHistory.ts create mode 100644 src/entities/ProfileInsignia.ts create mode 100644 src/entities/ProfileInsigniaHistory.ts create mode 100644 src/entities/ProfileTraining.ts create mode 100644 src/entities/ProfileTrainingHistory.ts diff --git a/src/entities/Profile.ts b/src/entities/Profile.ts index da7bde80..3f80a0c8 100644 --- a/src/entities/Profile.ts +++ b/src/entities/Profile.ts @@ -5,6 +5,12 @@ import { PosLevel } from "./PosLevel"; import { PosType } from "./PosType"; import { ProfileSalary } from "./ProfileSalary"; import { ProfileDiscipline } from "./ProfileDiscipline"; +import { ProfileCertificate } from "./ProfileCertificate"; +import { ProfileEducation } from "./ProfileEducation"; +import { ProfileTraining } from "./ProfileTraining"; +import { ProfileInsignia } from "./ProfileInsignia"; +import { ProfileHonor } from "./ProfileHonor"; +import { ProfileAssessment } from "./ProfileAssessment"; @Entity("profile") export class Profile extends EntityBase { @@ -124,7 +130,7 @@ export class Profile extends EntityBase { default: null, }) birthDate: Date; - + @OneToMany(() => PosMaster, (posMaster) => posMaster.current_holder) current_holders: PosMaster[]; @@ -137,6 +143,24 @@ export class Profile extends EntityBase { @OneToMany(() => ProfileDiscipline, (profileDiscipline) => profileDiscipline.profile) profileDiscipline: ProfileDiscipline[]; + @OneToMany(() => ProfileCertificate, (profileCertificate) => profileCertificate.profile) + profileCertificates: ProfileCertificate[]; + + @OneToMany(() => ProfileEducation, (profileEducation) => profileEducation.profile) + profileEducations: ProfileEducation[]; + + @OneToMany(() => ProfileTraining, (profileTraining) => profileTraining.profile) + profileTrainings: ProfileTraining[]; + + @OneToMany(() => ProfileInsignia, (profileInsignia) => profileInsignia.profile) + profileInsignias: ProfileInsignia[]; + + @OneToMany(() => ProfileHonor, (profileHonor) => profileHonor.profile) + profileHonors: ProfileHonor[]; + + @OneToMany(() => ProfileAssessment, (profileAssessment) => profileAssessment.profile) + profileAssessments: ProfileAssessment[]; + @ManyToOne(() => PosLevel, (posLevel) => posLevel.posLevels) @JoinColumn({ name: "posLevelId" }) posLevel: PosLevel; diff --git a/src/entities/ProfileAssessment.ts b/src/entities/ProfileAssessment.ts new file mode 100644 index 00000000..d69d67ab --- /dev/null +++ b/src/entities/ProfileAssessment.ts @@ -0,0 +1,126 @@ +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; diff --git a/src/entities/ProfileAssessmentHistory.ts b/src/entities/ProfileAssessmentHistory.ts new file mode 100644 index 00000000..2e8b9acf --- /dev/null +++ b/src/entities/ProfileAssessmentHistory.ts @@ -0,0 +1,125 @@ +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; diff --git a/src/entities/ProfileCertificate.ts b/src/entities/ProfileCertificate.ts new file mode 100644 index 00000000..10ebde66 --- /dev/null +++ b/src/entities/ProfileCertificate.ts @@ -0,0 +1,96 @@ +import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { Profile } from "./Profile"; +import { ProfileCertificateHistory } from "./ProfileCertificateHistory"; + +@Entity("profileCertificate") +export class ProfileCertificate extends EntityBase { + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง Profile", + default: null, + }) + profileId: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่หมดอายุ", + default: null, + }) + expireDate: Date; + + @Column({ + comment: "สถานะการใช้งาน", + default: false, + }) + isActive: boolean; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่ออกใบอนุญาต", + default: null, + }) + issueDate: Date; + + @Column({ + nullable: true, + comment: "เลขที่ใบอนุญาต", + length: 20, + default: null, + }) + certificateNo: string; + + @Column({ + nullable: true, + comment: "ชื่อใบอนุญาต", + length: 100, + default: null, + }) + certificateType: string; + + @Column({ + nullable: true, + comment: "หน่วยงานผู้ออกใบอนุญาต", + length: 200, + default: null, + }) + issuer: string; + + @OneToMany(() => ProfileCertificateHistory, (profileCertificateHistory) => profileCertificateHistory.histories) + profileCertificateHistories: ProfileCertificateHistory[]; + + @ManyToOne(() => Profile, (profile) => profile.profileCertificates) + @JoinColumn({ name: "profileId" }) + profile: Profile; + +} + +export class CreateProfileCertificate { + + @Column("uuid") + profileId: string | null; + + @Column() + expireDate: Date | null; + + @Column() + isActive: boolean; + + @Column() + issueDate: Date | null; + + @Column() + certificateNo: string | null; + + @Column() + certificateType: string | null; + + @Column() + issuer: string | null; + +} + +export type UpdateProfileCertificate = Partial; diff --git a/src/entities/ProfileCertificateHistory.ts b/src/entities/ProfileCertificateHistory.ts new file mode 100644 index 00000000..6ad1eb6f --- /dev/null +++ b/src/entities/ProfileCertificateHistory.ts @@ -0,0 +1,94 @@ +import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { Profile } from "./Profile"; +import { ProfileCertificate } from "./ProfileCertificate"; + +@Entity("profileCertificateHistory") +export class ProfileCertificateHistory extends EntityBase { + + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่หมดอายุ", + default: null, + }) + expireDate: Date; + + @Column({ + comment: "สถานะการใช้งาน", + default: false, + }) + isActive: boolean; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่ออกใบอนุญาต", + default: null, + }) + issueDate: Date; + + @Column({ + nullable: true, + comment: "เลขที่ใบอนุญาต", + length: 20, + default: null, + }) + certificateNo: string; + + @Column({ + nullable: true, + comment: "ชื่อใบอนุญาต", + length: 100, + default: null, + }) + certificateType: string; + + @Column({ + nullable: true, + comment: "หน่วยงานผู้ออกใบอนุญาต", + length: 200, + default: null, + }) + issuer: string; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง ProfileCertificate", + default: null, + }) + profileCertificateId: string; + + @ManyToOne(() => ProfileCertificate, (profileCertificate) => profileCertificate.profileCertificateHistories) + @JoinColumn({ name: "profileCertificateId" }) + histories: ProfileCertificate; + +} + +export class CreateProfileCertificateHistory { + + @Column() + expireDate: Date | null; + + @Column() + isActive: boolean; + + @Column() + issueDate: Date | null; + + @Column() + certificateNo: string | null; + + @Column() + certificateType: string | null; + + @Column() + issuer: string | null; + + @Column("uuid") + profileCertificateId: string | null; + +} + +export type UpdateProfileCertificateHistory = Partial; diff --git a/src/entities/ProfileEducation.ts b/src/entities/ProfileEducation.ts new file mode 100644 index 00000000..bd1da638 --- /dev/null +++ b/src/entities/ProfileEducation.ts @@ -0,0 +1,232 @@ +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, + 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; +} + +export type UpdateProfileEducation = Partial; diff --git a/src/entities/ProfileEducationHistory.ts b/src/entities/ProfileEducationHistory.ts new file mode 100644 index 00000000..c1d6cc33 --- /dev/null +++ b/src/entities/ProfileEducationHistory.ts @@ -0,0 +1,232 @@ +import { Entity, Column, ManyToOne, JoinColumn } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { Profile } from "./Profile"; +import { ProfileEducation } from "./ProfileEducation"; + +@Entity("profileEducationHistory") +export class ProfileEducationHistory extends EntityBase { + + @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, + 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)ของตาราง Profile", + default: null, + }) + profileEducationId: string; + + @ManyToOne(() => ProfileEducation, (profileEducation) => profileEducation.profileEducationHistories) + @JoinColumn({ name: "profileEducationId" }) + histories: ProfileEducation; + +} + +export class CreateProfileEducationHistory { + + @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("uuid") + profileEducationId: string | null; + +} + +export type UpdateProfileEducationHistory = Partial; diff --git a/src/entities/ProfileHonor.ts b/src/entities/ProfileHonor.ts new file mode 100644 index 00000000..ab9cf936 --- /dev/null +++ b/src/entities/ProfileHonor.ts @@ -0,0 +1,103 @@ +import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { Profile } from "./Profile"; +import { ProfileHonorHistory } from "./ProfileHonorHistory"; + +@Entity("profileHonor") +export class ProfileHonor extends EntityBase { + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง Profile", + default: null, + }) + profileId: string; + + @Column({ + comment: "สถานะการใช้งาน", + default: false, + }) + isActive: boolean; + + @Column({ + nullable: true, + length: 2000, + comment: "รายละเอียด", + default: null, + }) + detail: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่ได้รับ", + default: null, + }) + issueDate: Date; + + @Column({ + nullable: true, + length: 200, + comment: "หน่วยงานที่ออก", + default: null, + }) + issuer: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "เอกสารอ้างอิง (ลงวันที่)", + default: null, + }) + refCommandDate: Date; + + @Column({ + nullable: true, + comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)", + type: "text", + default: null, + }) + refCommandNo: string; + + @Column({ + nullable: true, + comment: "ประเภทช่วงเวลาการศึกษา", + default: null, + }) + isDate: boolean; + + @OneToMany(() => ProfileHonorHistory, (profileHonorHistory) => profileHonorHistory.histories) + profileHonorHistories: ProfileHonorHistory[]; + + @ManyToOne(() => Profile, (profile) => profile.profileHonors) + @JoinColumn({ name: "profileId" }) + profile: Profile; +} + +export class CreateProfileHonor { + @Column("uuid") + profileId: string | null; + + @Column() + isActive: boolean; + + @Column() + detail: string | null; + + @Column() + issueDate: Date | null; + + @Column() + issuer: string | null; + + @Column() + refCommandDate: Date | null; + + @Column() + refCommandNo: string | null; + + @Column() + isDate: boolean | null; +} + +export type UpdateProfileHonor = Partial; diff --git a/src/entities/ProfileHonorHistory.ts b/src/entities/ProfileHonorHistory.ts new file mode 100644 index 00000000..d871738b --- /dev/null +++ b/src/entities/ProfileHonorHistory.ts @@ -0,0 +1,92 @@ +import { Entity, Column, ManyToOne, JoinColumn } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { Profile } from "./Profile"; +import { ProfileHonor } from "./ProfileHonor"; + +@Entity("profileHonorHistory") +export class ProfileHonorHistory extends EntityBase { + + @Column({ + comment: "สถานะการใช้งาน", + default: false, + }) + isActive: boolean; + + @Column({ + nullable: true, + length: 2000, + comment: "รายละเอียด", + default: null, + }) + detail: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่ได้รับ", + default: null, + }) + issueDate: Date; + + @Column({ + nullable: true, + length: 200, + comment: "หน่วยงานที่ออก", + default: null, + }) + issuer: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "เอกสารอ้างอิง (ลงวันที่)", + default: null, + }) + refCommandDate: Date; + + @Column({ + nullable: true, + comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)", + type: "text", + default: null, + }) + refCommandNo: string; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง ProfileHonor", + default: null, + }) + profileHonorId: string; + + @ManyToOne(() => ProfileHonor, (profileHonor) => profileHonor.profileHonorHistories) + @JoinColumn({ name: "profileHonorId" }) + histories: ProfileHonor; +} + +export class CreateProfileHonorHistory { + + @Column() + isActive: boolean; + + @Column() + detail: string | null; + + @Column() + issueDate: Date | null; + + @Column() + issuer: string | null; + + @Column() + refCommandDate: Date | null; + + @Column() + refCommandNo: string | null; + + @Column("uuid") + profileHonorId: string | null; +} + +export type UpdateProfileHonorHistory = Partial; diff --git a/src/entities/ProfileInsignia.ts b/src/entities/ProfileInsignia.ts new file mode 100644 index 00000000..ee361bc6 --- /dev/null +++ b/src/entities/ProfileInsignia.ts @@ -0,0 +1,178 @@ +import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { Profile } from "./Profile"; +import { ProfileInsigniaHistory } from "./ProfileInsigniaHistory"; + +@Entity("profileInsignia") +export class ProfileInsignia extends EntityBase { + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง Profile", + default: null, + }) + profileId: string; + + @Column({ + comment: "สถานะการใช้งาน", + default: false, + }) + isActive: boolean; + + @Column({ + comment: "ปีที่ยื่นขอ", + }) + year: number; + + @Column({ + nullable: true, + length: 20, + comment: "ลำดับที่", + default: null, + }) + no: string; + + @Column({ + nullable: true, + length: 30, + comment: "เล่ม", + default: null, + }) + volume: string; + + @Column({ + nullable: true, + length: 30, + comment: "ตอน", + default: null, + }) + section: string; + + @Column({ + nullable: true, + length: 30, + comment: "หน้า", + default: null, + }) + page: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "ลงวันที่", + default: null, + }) + receiveDate: Date; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง Insignia", + default: null, + }) + insigniaId: string; + + @Column({ + nullable: true, + comment: "ประเภท", + type: "text", + default: null, + }) + insigniaType: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่ประกาศในราชกิจจาฯ", + default: null, + }) + dateAnnounce: Date; + + @Column({ + nullable: true, + length: 300, + comment: "ราชกิจจาฯ ฉบับที่", + default: null, + }) + issue: string; + + @Column({ + nullable: true, + length: 30, + comment: "เล่มที่", + default: null, + }) + volumeNo: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "เอกสารอ้างอิง (ลงวันที่)", + default: null, + }) + refCommandDate: Date; + + @Column({ + nullable: true, + comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)", + type: "text", + default: null, + }) + refCommandNo: string; + + @OneToMany(() => ProfileInsigniaHistory, (profileInsigniaHistory) => profileInsigniaHistory.histories) + profileInsigniaHistories: ProfileInsigniaHistory[]; + + @ManyToOne(() => Profile, (profile) => profile.profileInsignias) + @JoinColumn({ name: "profileId" }) + profile: Profile; +} + +export class CreateProfileInsignia { + @Column("uuid") + profileId: string | null; + + @Column() + isActive: boolean; + + @Column() + year: number; + + @Column() + no: string | null; + + @Column() + volume: string | null; + + @Column() + section: string | null; + + @Column() + page: string | null; + + @Column() + receiveDate: Date | null; + + @Column("uuid") + insigniaId: string | null; + + @Column() + insigniaType: string | null; + + @Column() + dateAnnounce: Date | null; + + @Column() + issue: string | null; + + @Column() + volumeNo: string | null; + + @Column() + refCommandDate: Date | null; + + @Column() + refCommandNo: string | null; +} + +export type UpdateProfileInsignia = Partial; diff --git a/src/entities/ProfileInsigniaHistory.ts b/src/entities/ProfileInsigniaHistory.ts new file mode 100644 index 00000000..a03c4b83 --- /dev/null +++ b/src/entities/ProfileInsigniaHistory.ts @@ -0,0 +1,177 @@ +import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { Profile } from "./Profile"; +import { ProfileInsignia } from "./ProfileInsignia"; + +@Entity("profileInsigniaHistory") +export class ProfileInsigniaHistory extends EntityBase { + + @Column({ + comment: "สถานะการใช้งาน", + default: false, + }) + isActive: boolean; + + @Column({ + comment: "ปีที่ยื่นขอ", + }) + year: number; + + @Column({ + nullable: true, + length: 20, + comment: "ลำดับที่", + default: null, + }) + no: string; + + @Column({ + nullable: true, + length: 30, + comment: "เล่ม", + default: null, + }) + volume: string; + + @Column({ + nullable: true, + length: 30, + comment: "ตอน", + default: null, + }) + section: string; + + @Column({ + nullable: true, + length: 30, + comment: "หน้า", + default: null, + }) + page: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "ลงวันที่", + default: null, + }) + receiveDate: Date; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง Insignia", + default: null, + }) + insigniaId: string; + + @Column({ + nullable: true, + comment: "ประเภท", + type: "text", + default: null, + }) + insigniaType: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่ประกาศในราชกิจจาฯ", + default: null, + }) + dateAnnounce: Date; + + @Column({ + nullable: true, + length: 300, + comment: "ราชกิจจาฯ ฉบับที่", + default: null, + }) + issue: string; + + @Column({ + nullable: true, + length: 30, + comment: "เล่มที่", + default: null, + }) + volumeNo: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "เอกสารอ้างอิง (ลงวันที่)", + default: null, + }) + refCommandDate: Date; + + @Column({ + nullable: true, + comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)", + type: "text", + default: null, + }) + refCommandNo: string; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง ProfileInsignia", + default: null, + }) + profileInsigniaId: string; + + @ManyToOne(() => ProfileInsignia, (profileInsignia) => profileInsignia.profileInsigniaHistories) + @JoinColumn({ name: "profileInsigniaId" }) + histories: ProfileInsignia; +} + +export class CreateProfileInsigniaHistory { + + @Column() + isActive: boolean; + + @Column() + year: number; + + @Column() + no: string | null; + + @Column() + volume: string | null; + + @Column() + section: string | null; + + @Column() + page: string | null; + + @Column() + receiveDate: Date | null; + + @Column("uuid") + insigniaId: string | null; + + @Column() + insigniaType: string | null; + + @Column() + dateAnnounce: Date | null; + + @Column() + issue: string | null; + + @Column() + volumeNo: string | null; + + @Column() + refCommandDate: Date | null; + + @Column() + refCommandNo: string | null; + + @Column("uuid") + profileInsigniaId: string | null; +} + +export type UpdateProfileInsigniaHistory = Partial; diff --git a/src/entities/ProfileTraining.ts b/src/entities/ProfileTraining.ts new file mode 100644 index 00000000..1866d0ad --- /dev/null +++ b/src/entities/ProfileTraining.ts @@ -0,0 +1,157 @@ +import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { Profile } from "./Profile"; +import { ProfileTrainingHistory } from "./ProfileTrainingHistory"; + +@Entity("profileTraining") +export class ProfileTraining extends EntityBase { + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง Profile", + default: null, + }) + profileId: string; + + @Column({ + comment: "สถานะการใช้งาน", + default: false, + }) + isActive: boolean; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันเริ่มต้นการฝึกอบรม/ดูงาน", + default: null, + }) + startDate: Date; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันสิ้นสุดการฝึกอบรม/ดูงาน", + default: null, + }) + endDate: Date; + + @Column({ + nullable: true, + length: 200, + comment: "เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ", + default: null, + }) + numberOrder: string; + + @Column({ + nullable: true, + length: 200, + comment: "หัวข้อการฝึกอบรม/ดูงาน", + default: null, + }) + topic: string; + + @Column({ + nullable: true, + length: 200, + comment: "สถานที่ฝึกอบรม/ดูงาน", + default: null, + }) + place: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่", + default: null, + }) + dateOrder: Date; + + @Column({ + nullable: true, + length: 200, + comment: "หน่วยงานที่รับผิดชอบจัดการฝึกอบรม/ดูงาน", + default: null, + }) + department: string; + + @Column({ + nullable: true, + length: 200, + comment: "รวมระยะเวลาในการฝึกอบรม/ดูงาน", + default: null, + }) + duration: string; + + @Column({ + nullable: true, + length: 200, + comment: "ชื่อโครงการ/หลักสูตรการฝึกอบรม", + default: null, + }) + name: string; + + @Column({ + nullable: true, + comment: "ปีที่อบรม (พ.ศ.)", + default: null, + }) + yearly: number; + + @Column({ + nullable: true, + comment: "ประเภทช่วงเวลาการศึกษา", + default: null, + }) + isDate: boolean; + + @OneToMany(() => ProfileTrainingHistory, (profileTrainingHistory) => profileTrainingHistory.histories) + profileTrainingHistories: ProfileTrainingHistory[]; + + @ManyToOne(() => Profile, (profile) => profile.profileTrainings) + @JoinColumn({ name: "profileId" }) + profile: Profile; +} + +export class CreateProfileTraining { + @Column("uuid") + profileId: string | null; + + @Column() + isActive: boolean; + + @Column() + startDate: Date | null; + + @Column() + endDate: Date | null; + + @Column() + numberOrder: string | null; + + @Column() + topic: string | null; + + @Column() + place: string | null; + + @Column() + dateOrder: Date | null; + + @Column() + department: string | null; + + @Column() + duration: string | null; + + @Column() + name: string | null; + + @Column() + yearly: number | null; + + @Column() + isDate: boolean | null; +} + +export type UpdateProfileTraining = Partial; diff --git a/src/entities/ProfileTrainingHistory.ts b/src/entities/ProfileTrainingHistory.ts new file mode 100644 index 00000000..9c0f7598 --- /dev/null +++ b/src/entities/ProfileTrainingHistory.ts @@ -0,0 +1,146 @@ +import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; +import { EntityBase } from "./base/Base"; +import { Profile } from "./Profile"; +import { ProfileTraining } from "./ProfileTraining"; + +@Entity("profileTrainingHistory") +export class ProfileTrainingHistory extends EntityBase { + + @Column({ + comment: "สถานะการใช้งาน", + default: false, + }) + isActive: boolean; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันเริ่มต้นการฝึกอบรม/ดูงาน", + default: null, + }) + startDate: Date; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันสิ้นสุดการฝึกอบรม/ดูงาน", + default: null, + }) + endDate: Date; + + @Column({ + nullable: true, + length: 200, + comment: "เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ", + default: null, + }) + numberOrder: string; + + @Column({ + nullable: true, + length: 200, + comment: "หัวข้อการฝึกอบรม/ดูงาน", + default: null, + }) + topic: string; + + @Column({ + nullable: true, + length: 200, + comment: "สถานที่ฝึกอบรม/ดูงาน", + default: null, + }) + place: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่", + default: null, + }) + dateOrder: Date; + + @Column({ + nullable: true, + length: 200, + comment: "หน่วยงานที่รับผิดชอบจัดการฝึกอบรม/ดูงาน", + default: null, + }) + department: string; + + @Column({ + nullable: true, + length: 200, + comment: "รวมระยะเวลาในการฝึกอบรม/ดูงาน", + default: null, + }) + duration: string; + + @Column({ + nullable: true, + length: 200, + comment: "ชื่อโครงการ/หลักสูตรการฝึกอบรม", + default: null, + }) + name: string; + + @Column({ + nullable: true, + comment: "ปีที่อบรม (พ.ศ.)", + default: null, + }) + yearly: number; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง ProfileTraining", + default: null, + }) + profileTrainingId: string; + + @ManyToOne(() => ProfileTraining, (profileTraining) => profileTraining.profileTrainingHistories) + @JoinColumn({ name: "profileTrainingId" }) + histories: ProfileTraining; +} + +export class CreateProfileTrainingHistory { + + @Column() + isActive: boolean; + + @Column() + startDate: Date | null; + + @Column() + endDate: Date | null; + + @Column() + numberOrder: string | null; + + @Column() + topic: string | null; + + @Column() + place: string | null; + + @Column() + dateOrder: Date | null; + + @Column() + department: string | null; + + @Column() + duration: string | null; + + @Column() + name: string | null; + + @Column() + yearly: number | null; + + @Column("uuid") + profileTrainingId: string | null; +} + +export type UpdateProfileTrainingHistory = Partial;