diff --git a/src/controllers/EmployeePositionController.ts b/src/controllers/EmployeePositionController.ts index cdfe1b66..547ec5ae 100644 --- a/src/controllers/EmployeePositionController.ts +++ b/src/controllers/EmployeePositionController.ts @@ -269,6 +269,7 @@ export class EmployeePositionController extends Controller { findData = await this.employeePosDictRepository.find({ where: { posDictName: Like(`%${keyword}%`) }, relations: ["posType", "posLevel"], + order: { posLevel: { posLevelName: "ASC" } }, }); break; @@ -280,6 +281,7 @@ export class EmployeePositionController extends Controller { findData = await this.employeePosDictRepository.find({ where: { posTypeId: In(findEmpTypes.map((x) => x.id)) }, relations: ["posType", "posLevel"], + order: { posLevel: { posLevelName: "ASC" } }, }); break; @@ -291,11 +293,13 @@ export class EmployeePositionController extends Controller { findData = await this.employeePosDictRepository.find({ where: { posLevelId: In(findEmpLevels.map((x) => x.id)) }, relations: ["posType", "posLevel"], + order: { posLevel: { posLevelName: "ASC" } }, }); } else { //กรณีเลือกค้นหาจาก"ระดับชั้นงาน" แต่กรอกไม่ใช่ number ให้ปล่อยมาหมดเลย findData = await this.employeePosDictRepository.find({ relations: ["posType", "posLevel"], + order: { posLevel: { posLevelName: "ASC" } }, }); } break; @@ -303,6 +307,7 @@ export class EmployeePositionController extends Controller { default: findData = await this.employeePosDictRepository.find({ relations: ["posType", "posLevel"], + order: { posLevel: { posLevelName: "ASC" } }, }); break; } diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index 2f9973c1..41b3456c 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -159,7 +159,8 @@ export class PositionController extends Controller { requestBody: CreatePosDictExe, @Request() request: { user: Record }, ) { - let posDict: any; + // let posDict: PosDict; + let posDict: any = new PosDict(); posDict.posDictName = requestBody.posDictName; posDict.posDictField = requestBody.posDictField; posDict.posTypeId = requestBody.posTypeId; @@ -182,7 +183,7 @@ export class PositionController extends Controller { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล PosLevelId"); } - let posExecutive: any = null; + let posExecutive: any = new PosExecutive(); if (requestBody.posExecutive != null && requestBody.posExecutive != "") { const checkName = await this.posExecutiveRepository.findOne({ where: { posExecutiveName: requestBody.posExecutive }, @@ -192,8 +193,11 @@ export class PositionController extends Controller { throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อนี้มีอยู่ในระบบแล้ว"); } posExecutive.posExecutiveName = requestBody.posExecutive; - const checkPriority = await this.posExecutiveRepository.findOne({ + select: ["posExecutivePriority"], + where: { + posExecutivePriority: Not(IsNull()), + }, order: { posExecutivePriority: "DESC" }, }); if (checkPriority == null) { diff --git a/src/controllers/ProfileEducationsController.ts b/src/controllers/ProfileEducationsController.ts index c12cf4bd..0a31993e 100644 --- a/src/controllers/ProfileEducationsController.ts +++ b/src/controllers/ProfileEducationsController.ts @@ -70,6 +70,7 @@ export class ProfileEducationsController extends Controller { educationLevelId: "string", positionPath: "string", positionPathId: "string", + note: "string", isDate: true, isEducation: true, }, @@ -113,6 +114,7 @@ export class ProfileEducationsController extends Controller { educationLevelId: "string", positionPath: "string", positionPathId: "string", + note: "string", isDate: true, isEducation: true, profileEducationId: "f6c693b4-1a9b-4fbe-95c5-ed4da50d35b6", @@ -142,6 +144,7 @@ export class ProfileEducationsController extends Controller { educationLevelId: "string", positionPath: "string", positionPathId: "string", + note: "string", isDate: true, isEducation: true, profileEducationId: "f6c693b4-1a9b-4fbe-95c5-ed4da50d35b6", diff --git a/src/controllers/ProfileHonorController.ts b/src/controllers/ProfileHonorController.ts index 8d71dece..96c76d86 100644 --- a/src/controllers/ProfileHonorController.ts +++ b/src/controllers/ProfileHonorController.ts @@ -77,6 +77,7 @@ export class ProfileHonorController extends Controller { issuer: "issuer", refCommandDate: "2024-03-12T10:10:31.000Z", refCommandNo: "refCommandNo", + isDate: true, profileHonorId: "debfa8a7-83fb-4801-a940-8ae74e7638d3", }, { @@ -93,6 +94,7 @@ export class ProfileHonorController extends Controller { issuer: "string", refCommandDate: "2024-03-12T10:09:47.000Z", refCommandNo: "string", + isDate: true, profileHonorId: "debfa8a7-83fb-4801-a940-8ae74e7638d3", }, ], diff --git a/src/controllers/ProfileInsigniaController.ts b/src/controllers/ProfileInsigniaController.ts index a999b495..bdd04120 100644 --- a/src/controllers/ProfileInsigniaController.ts +++ b/src/controllers/ProfileInsigniaController.ts @@ -61,6 +61,7 @@ export class ProfileInsigniaController extends Controller { volumeNo: "string", refCommandDate: "2024-03-12T10:05:02.000Z", refCommandNo: "string", + note: "string", }, ], }) @@ -96,6 +97,7 @@ export class ProfileInsigniaController extends Controller { volumeNo: "volumeNo", refCommandDate: "2024-03-12T10:05:44.000Z", refCommandNo: "refCommandNo", + note: "string", profileInsigniaId: "c9d4dd52-25f5-491a-852d-28bfe00d66cb", }, { @@ -120,6 +122,7 @@ export class ProfileInsigniaController extends Controller { volumeNo: "string", refCommandDate: "2024-03-12T10:05:02.000Z", refCommandNo: "string", + note: "string", profileInsigniaId: "c9d4dd52-25f5-491a-852d-28bfe00d66cb", }, ], diff --git a/src/controllers/ProfileTrainingController.ts b/src/controllers/ProfileTrainingController.ts index 68857e2f..00585eca 100644 --- a/src/controllers/ProfileTrainingController.ts +++ b/src/controllers/ProfileTrainingController.ts @@ -91,6 +91,7 @@ export class ProfileTrainingController extends Controller { duration: "string", name: "string", yearly: 0, + isDate: true, profileTrainingId: "3cf02fb7-2f0c-471b-b641-51d557375c0a", }, { @@ -112,6 +113,7 @@ export class ProfileTrainingController extends Controller { duration: "string", name: "name", yearly: 0, + isDate: true, profileTrainingId: "3cf02fb7-2f0c-471b-b641-51d557375c0a", }, ], diff --git a/src/entities/ProfileAbility.ts b/src/entities/ProfileAbility.ts index 697c34e3..261484a8 100644 --- a/src/entities/ProfileAbility.ts +++ b/src/entities/ProfileAbility.ts @@ -18,7 +18,7 @@ export class ProfileAbility extends EntityBase { default: false, }) isActive: boolean; - + @Column({ nullable: true, comment: "หมายเหตุ", @@ -67,7 +67,10 @@ export class ProfileAbility extends EntityBase { }) field: string; - @OneToMany(() => ProfileAbilityHistory, (profileAbilityHistory) => profileAbilityHistory.histories) + @OneToMany( + () => ProfileAbilityHistory, + (profileAbilityHistory) => profileAbilityHistory.histories, + ) profileAbilityHistorys: ProfileAbilityHistory[]; @ManyToOne(() => Profile, (profile) => profile.profileAbilities) @@ -76,29 +79,23 @@ export class ProfileAbility extends EntityBase { } export class CreateProfileAbility { - @Column("uuid") profileId: string | null; - - @Column() isActive: boolean; - - @Column() remark: string | null; - - @Column() detail: string | null; - - @Column() reference: string | null; - - @Column() dateStart: Date | null; - - @Column() dateEnd: Date | null; - - @Column() field: string | null; } -export type UpdateProfileAbility = Partial; +export type UpdateProfileAbility = { + profileId: string | null; + isActive: boolean; + remark: string | null; + detail: string | null; + reference: string | null; + dateStart?: Date | null; + dateEnd?: Date | null; + field: string | null; +}; diff --git a/src/entities/ProfileAbilityHistory.ts b/src/entities/ProfileAbilityHistory.ts index 61f6364b..04974946 100644 --- a/src/entities/ProfileAbilityHistory.ts +++ b/src/entities/ProfileAbilityHistory.ts @@ -5,13 +5,12 @@ import { ProfileAbility } from "./ProfileAbility"; @Entity("profileAbilityHistory") export class ProfileAbilityHistory extends EntityBase { - @Column({ comment: "สถานะการใช้งาน", default: false, }) isActive: boolean; - + @Column({ nullable: true, comment: "หมายเหตุ", @@ -72,32 +71,3 @@ export class ProfileAbilityHistory extends EntityBase { @JoinColumn({ name: "profileAbilityId" }) histories: ProfileAbility; } - -export class CreateProfileAbilityHistory { - - @Column() - isActive: boolean; - - @Column() - remark: string | null; - - @Column() - detail: string | null; - - @Column() - reference: string | null; - - @Column() - dateStart: Date | null; - - @Column() - dateEnd: Date | null; - - @Column() - field: string | null; - - @Column("uuid") - ProfileAbilityId: string | null; -} - -export type UpdateProfileAbilityHistory = Partial; diff --git a/src/entities/ProfileAssessment.ts b/src/entities/ProfileAssessment.ts index d69d67ab..b6c7f5e5 100644 --- a/src/entities/ProfileAssessment.ts +++ b/src/entities/ProfileAssessment.ts @@ -22,11 +22,11 @@ export class ProfileAssessment extends EntityBase { @Column({ nullable: true, comment: "ชื่อแบบประเมิน", - type: "text", + type: "text", default: null, }) name: string; - + @Column({ nullable: true, type: "datetime", @@ -83,7 +83,10 @@ export class ProfileAssessment extends EntityBase { }) pointSumTotal: number; - @OneToMany(() => ProfileAssessmentHistory, (profileAssessmentHistory) => profileAssessmentHistory.histories) + @OneToMany( + () => ProfileAssessmentHistory, + (profileAssessmentHistory) => profileAssessmentHistory.histories, + ) profileAssessmentHistorys: ProfileAssessmentHistory[]; @ManyToOne(() => Profile, (profile) => profile.profileAssessments) @@ -92,35 +95,27 @@ export class ProfileAssessment extends EntityBase { } 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; +export type UpdateProfileAssessment = { + profileId: string | null; + isActive: boolean; + name: string | null; + date?: Date | null; + point1: number | null; + point1Total: number | null; + point2: number | null; + point2Total: number | null; + pointSum: number | null; + pointSumTotal: number | null; +}; diff --git a/src/entities/ProfileAssessmentHistory.ts b/src/entities/ProfileAssessmentHistory.ts index 2e8b9acf..46c5d533 100644 --- a/src/entities/ProfileAssessmentHistory.ts +++ b/src/entities/ProfileAssessmentHistory.ts @@ -5,7 +5,6 @@ import { ProfileAssessment } from "./ProfileAssessment"; @Entity("profileAssessmentHistory") export class ProfileAssessmentHistory extends EntityBase { - @Column({ comment: "สถานะการใช้งาน", default: false, @@ -15,11 +14,11 @@ export class ProfileAssessmentHistory extends EntityBase { @Column({ nullable: true, comment: "ชื่อแบบประเมิน", - type: "text", + type: "text", default: null, }) name: string; - + @Column({ nullable: true, type: "datetime", @@ -83,43 +82,11 @@ export class ProfileAssessmentHistory extends EntityBase { default: null, }) profileAssessmentId: string; - - @ManyToOne(() => ProfileAssessment, (profileAssessment) => profileAssessment.profileAssessmentHistorys) + + @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/ProfileDiscipline.ts b/src/entities/ProfileDiscipline.ts index 0a4fbcc1..f6a332f0 100644 --- a/src/entities/ProfileDiscipline.ts +++ b/src/entities/ProfileDiscipline.ts @@ -41,7 +41,7 @@ export class ProfileDiscipline extends EntityBase { default: null, }) detail: string; - + @Column({ nullable: true, type: "datetime", @@ -66,7 +66,10 @@ export class ProfileDiscipline extends EntityBase { }) unStigma: string; - @OneToMany(() => ProfileDisciplineHistory, (profileDisciplineHistory) => profileDisciplineHistory.histories) + @OneToMany( + () => ProfileDisciplineHistory, + (profileDisciplineHistory) => profileDisciplineHistory.histories, + ) profileDisciplineHistories: ProfileDisciplineHistory[]; @ManyToOne(() => Profile, (profile) => profile.profileDiscipline) @@ -75,30 +78,23 @@ export class ProfileDiscipline extends EntityBase { } export class CreateProfileDiscipline { - - @Column() date: Date | null; - - @Column() profileId: string; - - @Column() isActive: boolean | null; - - @Column() - level: string | null; - - @Column() + level: string | null; detail: string | null; - - @Column() refCommandDate: Date | null; - - @Column() refCommandNo: string | null; - - @Column() unStigma: string | null; } -export type UpdateProfileDiscipline = Partial; \ No newline at end of file +export type UpdateProfileDiscipline = { + date?: Date | null; + profileId: string; + isActive: boolean | null; + level: string | null; + detail: string | null; + refCommandDate?: Date | null; + refCommandNo: string | null; + unStigma: string | null; +}; diff --git a/src/entities/ProfileDuty.ts b/src/entities/ProfileDuty.ts index fcb869f3..da3e5749 100644 --- a/src/entities/ProfileDuty.ts +++ b/src/entities/ProfileDuty.ts @@ -76,29 +76,23 @@ export class ProfileDuty extends EntityBase { } export class CreateProfileDuty { - @Column("uuid") profileId: string | null; - - @Column() isActive: boolean; - - @Column() dateStart: Date | null; - - @Column() dateEnd: Date | null; - - @Column() detail: string | null; - - @Column() reference: string | null; - - @Column() refCommandDate: Date | null; - - @Column() refCommandNo: string | null; } -export type UpdateProfileDuty = Partial; +export type UpdateProfileDuty = { + profileId: string | null; + isActive: boolean; + dateStart?: Date | null; + dateEnd?: Date | null; + detail: string | null; + reference: string | null; + refCommandDate?: Date | null; + refCommandNo: string | null; +}; diff --git a/src/entities/ProfileDutyHistory.ts b/src/entities/ProfileDutyHistory.ts index 8f7da298..989cefba 100644 --- a/src/entities/ProfileDutyHistory.ts +++ b/src/entities/ProfileDutyHistory.ts @@ -5,7 +5,6 @@ import { ProfileDuty } from "./ProfileDuty"; @Entity("profileDutyHistory") export class ProfileDutyHistory extends EntityBase { - @Column({ comment: "สถานะการใช้งาน", default: false, @@ -68,37 +67,7 @@ export class ProfileDutyHistory extends EntityBase { }) profileDutyId: string; - @ManyToOne(() => ProfileDuty, (profileDuty) => profileDuty.profileDutyHistories) @JoinColumn({ name: "profileDutyId" }) histories: ProfileDuty; } - -export class CreateProfileDutyHistory { - - @Column() - isActive: boolean; - - @Column() - dateStart: Date | null; - - @Column() - dateEnd: Date | null; - - @Column() - detail: string | null; - - @Column() - reference: string | null; - - @Column() - refCommandDate: Date | null; - - @Column() - refCommandNo: string | null; - - @Column("uuid") - profileDutyId: string | null; -} - -export type UpdateProfileDutyHistory = Partial; diff --git a/src/entities/ProfileEducation.ts b/src/entities/ProfileEducation.ts index 88991be8..974d68ab 100644 --- a/src/entities/ProfileEducation.ts +++ b/src/entities/ProfileEducation.ts @@ -115,7 +115,7 @@ export class ProfileEducation extends EntityBase { @Column({ nullable: true, comment: "ระดับศึกษา", - type: "text", // ใช้ "text" แทน "string" เพื่อรองรับ long text + type: "text", // ใช้ "text" แทน "string" เพื่อรองรับ long text default: null, }) educationLevel: string; @@ -164,14 +164,16 @@ export class ProfileEducation extends EntityBase { default: null, }) isEducation: boolean; - - @OneToMany(() => ProfileEducationHistory, (profileEducationHistory) => profileEducationHistory.histories) + + @OneToMany( + () => ProfileEducationHistory, + (profileEducationHistory) => profileEducationHistory.histories, + ) profileEducationHistories: ProfileEducationHistory[]; @ManyToOne(() => Profile, (profile) => profile.profileEducations) @JoinColumn({ name: "profileId" }) profile: Profile; - } export class CreateProfileEducation { @@ -234,6 +236,9 @@ export class CreateProfileEducation { @Column() isEducation: boolean | null; + + @Column() + note: string | null; } export type UpdateProfileEducation = Partial; diff --git a/src/entities/ProfileEducationHistory.ts b/src/entities/ProfileEducationHistory.ts index c1d6cc33..3454130c 100644 --- a/src/entities/ProfileEducationHistory.ts +++ b/src/entities/ProfileEducationHistory.ts @@ -5,7 +5,6 @@ import { ProfileEducation } from "./ProfileEducation"; @Entity("profileEducationHistory") export class ProfileEducationHistory extends EntityBase { - @Column({ comment: "สถานะการใช้งาน", default: false, @@ -108,7 +107,7 @@ export class ProfileEducationHistory extends EntityBase { @Column({ nullable: true, comment: "ระดับศึกษา", - type: "text", // ใช้ "text" แทน "string" เพื่อรองรับ long text + type: "text", // ใช้ "text" แทน "string" เพื่อรองรับ long text default: null, }) educationLevel: string; @@ -151,6 +150,13 @@ export class ProfileEducationHistory extends EntityBase { }) isEducation: boolean; + @Column({ + nullable: true, + comment: "หมายเหตุ", + default: null, + }) + note: string; + @Column({ nullable: true, length: 40, @@ -158,15 +164,16 @@ export class ProfileEducationHistory extends EntityBase { default: null, }) profileEducationId: string; - - @ManyToOne(() => ProfileEducation, (profileEducation) => profileEducation.profileEducationHistories) + + @ManyToOne( + () => ProfileEducation, + (profileEducation) => profileEducation.profileEducationHistories, + ) @JoinColumn({ name: "profileEducationId" }) histories: ProfileEducation; - } export class CreateProfileEducationHistory { - @Column() isActive: boolean; @@ -227,6 +234,8 @@ export class CreateProfileEducationHistory { @Column("uuid") profileEducationId: string | null; + @Column() + note: string | null; } export type UpdateProfileEducationHistory = Partial; diff --git a/src/entities/ProfileHonorHistory.ts b/src/entities/ProfileHonorHistory.ts index d871738b..4c4c5304 100644 --- a/src/entities/ProfileHonorHistory.ts +++ b/src/entities/ProfileHonorHistory.ts @@ -5,7 +5,6 @@ import { ProfileHonor } from "./ProfileHonor"; @Entity("profileHonorHistory") export class ProfileHonorHistory extends EntityBase { - @Column({ comment: "สถานะการใช้งาน", default: false, @@ -60,13 +59,19 @@ export class ProfileHonorHistory extends EntityBase { }) profileHonorId: string; + @Column({ + nullable: true, + comment: "ประเภทช่วงเวลาการศึกษา", + default: null, + }) + isDate: boolean; + @ManyToOne(() => ProfileHonor, (profileHonor) => profileHonor.profileHonorHistories) @JoinColumn({ name: "profileHonorId" }) histories: ProfileHonor; } export class CreateProfileHonorHistory { - @Column() isActive: boolean; @@ -80,11 +85,14 @@ export class CreateProfileHonorHistory { issuer: string | null; @Column() - refCommandDate: Date | null; + refCommandDate: Date | null; @Column() refCommandNo: string | null; + @Column() + isDate: boolean | null; + @Column("uuid") profileHonorId: string | null; } diff --git a/src/entities/ProfileInsignia.ts b/src/entities/ProfileInsignia.ts index 7c883dc6..cc7c1298 100644 --- a/src/entities/ProfileInsignia.ts +++ b/src/entities/ProfileInsignia.ts @@ -47,7 +47,7 @@ export class ProfileInsignia extends EntityBase { default: null, }) section: string; - + @Column({ nullable: true, length: 30, @@ -63,7 +63,7 @@ export class ProfileInsignia extends EntityBase { default: null, }) receiveDate: Date; - + @Column({ nullable: true, length: 40, @@ -71,7 +71,7 @@ export class ProfileInsignia extends EntityBase { default: null, }) insigniaId: string; - + @Column({ nullable: true, comment: "ประเภท", @@ -127,7 +127,10 @@ export class ProfileInsignia extends EntityBase { }) note: string; - @OneToMany(() => ProfileInsigniaHistory, (profileInsigniaHistory) => profileInsigniaHistory.histories) + @OneToMany( + () => ProfileInsigniaHistory, + (profileInsigniaHistory) => profileInsigniaHistory.histories, + ) profileInsigniaHistories: ProfileInsigniaHistory[]; @ManyToOne(() => Profile, (profile) => profile.profileInsignias) @@ -141,7 +144,7 @@ export class CreateProfileInsignia { @Column() isActive: boolean; - + @Column() year: number; @@ -153,16 +156,16 @@ export class CreateProfileInsignia { @Column() section: string | null; - + @Column() page: string | null; @Column() receiveDate: Date | null; - + @Column("uuid") insigniaId: string | null; - + @Column() insigniaType: string | null; @@ -180,6 +183,9 @@ export class CreateProfileInsignia { @Column() refCommandNo: string | null; + + @Column() + note: string | null; } export type UpdateProfileInsignia = Partial; diff --git a/src/entities/ProfileInsigniaHistory.ts b/src/entities/ProfileInsigniaHistory.ts index a03c4b83..7ca99f56 100644 --- a/src/entities/ProfileInsigniaHistory.ts +++ b/src/entities/ProfileInsigniaHistory.ts @@ -5,7 +5,6 @@ import { ProfileInsignia } from "./ProfileInsignia"; @Entity("profileInsigniaHistory") export class ProfileInsigniaHistory extends EntityBase { - @Column({ comment: "สถานะการใช้งาน", default: false, @@ -40,7 +39,7 @@ export class ProfileInsigniaHistory extends EntityBase { default: null, }) section: string; - + @Column({ nullable: true, length: 30, @@ -56,7 +55,7 @@ export class ProfileInsigniaHistory extends EntityBase { default: null, }) receiveDate: Date; - + @Column({ nullable: true, length: 40, @@ -64,7 +63,7 @@ export class ProfileInsigniaHistory extends EntityBase { default: null, }) insigniaId: string; - + @Column({ nullable: true, comment: "ประเภท", @@ -113,6 +112,13 @@ export class ProfileInsigniaHistory extends EntityBase { }) refCommandNo: string; + @Column({ + nullable: true, + comment: "หมายเหตุ", + default: null, + }) + note: string; + @Column({ nullable: true, length: 40, @@ -127,10 +133,9 @@ export class ProfileInsigniaHistory extends EntityBase { } export class CreateProfileInsigniaHistory { - @Column() isActive: boolean; - + @Column() year: number; @@ -142,16 +147,16 @@ export class CreateProfileInsigniaHistory { @Column() section: string | null; - + @Column() page: string | null; @Column() receiveDate: Date | null; - + @Column("uuid") insigniaId: string | null; - + @Column() insigniaType: string | null; @@ -170,6 +175,9 @@ export class CreateProfileInsigniaHistory { @Column() refCommandNo: string | null; + @Column() + note: string | null; + @Column("uuid") profileInsigniaId: string | null; } diff --git a/src/entities/ProfileLeave.ts b/src/entities/ProfileLeave.ts index 04b56450..f10e91c5 100644 --- a/src/entities/ProfileLeave.ts +++ b/src/entities/ProfileLeave.ts @@ -259,7 +259,7 @@ export class ProfileLeave extends EntityBase { }) typeLeaveId: string; - @Column({ + @Column({ nullable: true, comment: "เหตุผล", type: "text", @@ -276,104 +276,73 @@ export class ProfileLeave extends EntityBase { } export class CreateProfileLeave { - @Column("uuid") profileId: string | null; - - @Column() isActive: boolean; - - @Column() restCount: number | null; - - @Column() restDay: number | null; - - @Column() sickCount: number | null; - - @Column() sickDay: number | null; - - @Column() otherDay: number | null; - - @Column() personalCount: number | null; - - @Column() personalDay: number | null; - - @Column() studyCount: number | null; - - @Column() absentCount: number | null; - - @Column() absentDay: number | null; - - @Column() agencyCount: number | null; - - @Column() - agencyDay: number | null; - - @Column() + agencyDay: number | null; coupleCount: number | null; - - @Column() coupleDay: number | null; - - @Column() lateCount: number | null; - - @Column() lateDay: number | null; - - @Column() maternityCount: number | null; - - @Column() maternityDay: number | null; - - @Column() militaryCount: number | null; - - @Column() militaryDay: number | null; - - @Column() ordainCount: number | null; - - @Column() ordainDay: number | null; - - @Column() otherCount: number | null; - - @Column() dateStartLeave: Date | null; - - @Column() dateEndLeave: Date | null; - - @Column() numLeave: number | null; - - @Column() sumLeave: number | null; - - @Column() totalLeave: number | null; - - @Column() status: string | null; - - @Column("uuid") typeLeaveId: string | null; - - @Column() reason: string | null; } -export type UpdateProfileLeave = Partial; +export type UpdateProfileLeave = { + profileId: string | null; + isActive: boolean; + restCount: number | null; + restDay: number | null; + sickCount: number | null; + sickDay: number | null; + otherDay: number | null; + personalCount: number | null; + personalDay: number | null; + studyCount: number | null; + absentCount: number | null; + absentDay: number | null; + agencyCount: number | null; + agencyDay: number | null; + coupleCount: number | null; + coupleDay: number | null; + lateCount: number | null; + lateDay: number | null; + maternityCount: number | null; + maternityDay: number | null; + militaryCount: number | null; + militaryDay: number | null; + ordainCount: number | null; + ordainDay: number | null; + otherCount: number | null; + dateStartLeave?: Date | null; + dateEndLeave?: Date | null; + numLeave: number | null; + sumLeave: number | null; + totalLeave: number | null; + status: string | null; + typeLeaveId: string | null; + reason: string | null; +}; diff --git a/src/entities/ProfileNopaid.ts b/src/entities/ProfileNopaid.ts index 0b877d3d..b985994a 100644 --- a/src/entities/ProfileNopaid.ts +++ b/src/entities/ProfileNopaid.ts @@ -68,27 +68,21 @@ export class ProfileNopaid extends EntityBase { } export class CreateProfileNopaid { - @Column("uuid") profileId: string | null; - - @Column() isActive: boolean; - - @Column() date: Date | null; - - @Column() detail: string | null; - - @Column() reference: string | null; - - @Column() refCommandDate: Date | null; - - @Column() refCommandNo: string | null; - } -export type UpdateProfileNopaid = Partial; +export type UpdateProfileNopaid = { + profileId: string | null; + isActive: boolean; + date?: Date | null; + detail: string | null; + reference: string | null; + refCommandDate?: Date | null; + refCommandNo: string | null; +}; diff --git a/src/entities/ProfileNopaidHistory.ts b/src/entities/ProfileNopaidHistory.ts index efdc8641..e8f4cf71 100644 --- a/src/entities/ProfileNopaidHistory.ts +++ b/src/entities/ProfileNopaidHistory.ts @@ -5,7 +5,6 @@ import { ProfileNopaid } from "./ProfileNopaid"; @Entity("profileNopaidHistory") export class ProfileNopaidHistory extends EntityBase { - @Column({ comment: "สถานะการใช้งาน", default: false, @@ -60,35 +59,7 @@ export class ProfileNopaidHistory extends EntityBase { }) profileNopaidId: string; - @ManyToOne(() => ProfileNopaid, (profileNopaid) => profileNopaid.profileNopaidHistories) @JoinColumn({ name: "profileNopaidId" }) histories: ProfileNopaid; } - -export class CreateProfileNopaidHistory { - - @Column() - isActive: boolean; - - @Column() - date: Date | null; - - @Column() - detail: string | null; - - @Column() - reference: string | null; - - @Column() - refCommandDate: Date | null; - - @Column() - refCommandNo: string | null; - - @Column("uuid") - profileNopaidId: string | null; - -} - -export type UpdateProfileNopaidHistory = Partial; diff --git a/src/entities/ProfileOther.ts b/src/entities/ProfileOther.ts index 96dee565..941ecffe 100644 --- a/src/entities/ProfileOther.ts +++ b/src/entities/ProfileOther.ts @@ -18,7 +18,7 @@ export class ProfileOther extends EntityBase { default: false, }) isActive: boolean; - + @Column({ nullable: true, comment: "รายละเอียด", @@ -44,17 +44,15 @@ export class ProfileOther extends EntityBase { } export class CreateProfileOther { - @Column("uuid") profileId: string | null; - - @Column() isActive: boolean; - - @Column() detail: string | null; - - @Column() date: Date | null; } -export type UpdateProfileOther = Partial; +export type UpdateProfileOther = { + profileId: string | null; + isActive: boolean; + detail: string | null; + date?: Date | null; +}; diff --git a/src/entities/ProfileOtherHistory.ts b/src/entities/ProfileOtherHistory.ts index fce37b14..ed374bef 100644 --- a/src/entities/ProfileOtherHistory.ts +++ b/src/entities/ProfileOtherHistory.ts @@ -17,7 +17,7 @@ export class ProfileOtherHistory extends EntityBase { default: false, }) isActive: boolean; - + @Column({ nullable: true, comment: "รายละเอียด", @@ -38,19 +38,3 @@ export class ProfileOtherHistory extends EntityBase { @JoinColumn({ name: "profileOtherId" }) histories: ProfileOther; } - -export class CreateProfileOtherHistory { - @Column("uuid") - profileOtherId: string | null; - - @Column() - isActive: boolean; - - @Column() - detail: string | null; - - @Column() - date: Date | null; -} - -export type UpdateProfileOtherHistory = Partial; diff --git a/src/entities/ProfileTraining.ts b/src/entities/ProfileTraining.ts index 1866d0ad..30b1256d 100644 --- a/src/entities/ProfileTraining.ts +++ b/src/entities/ProfileTraining.ts @@ -104,8 +104,11 @@ export class ProfileTraining extends EntityBase { default: null, }) isDate: boolean; - - @OneToMany(() => ProfileTrainingHistory, (profileTrainingHistory) => profileTrainingHistory.histories) + + @OneToMany( + () => ProfileTrainingHistory, + (profileTrainingHistory) => profileTrainingHistory.histories, + ) profileTrainingHistories: ProfileTrainingHistory[]; @ManyToOne(() => Profile, (profile) => profile.profileTrainings) @@ -114,44 +117,33 @@ export class ProfileTraining extends EntityBase { } export class CreateProfileTraining { - @Column("uuid") profileId: string | null; - - @Column() isActive: boolean; - - @Column() startDate: Date | null; - - @Column() endDate: Date | null; - - @Column() - numberOrder: string | null; - - @Column() + numberOrder: string | null; 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; +export type UpdateProfileTraining = { + profileId: string | null; + isActive: boolean; + startDate?: Date | null; + endDate?: Date | null; + numberOrder: string | null; + topic: string | null; + place: string | null; + dateOrder?: Date | null; + department: string | null; + duration: string | null; + name: string | null; + yearly: number | null; + isDate: boolean | null; +}; diff --git a/src/entities/ProfileTrainingHistory.ts b/src/entities/ProfileTrainingHistory.ts index 9c0f7598..cfab7363 100644 --- a/src/entities/ProfileTrainingHistory.ts +++ b/src/entities/ProfileTrainingHistory.ts @@ -5,7 +5,6 @@ import { ProfileTraining } from "./ProfileTraining"; @Entity("profileTrainingHistory") export class ProfileTrainingHistory extends EntityBase { - @Column({ comment: "สถานะการใช้งาน", default: false, @@ -98,49 +97,15 @@ export class ProfileTrainingHistory extends EntityBase { default: null, }) profileTrainingId: string; - + + @Column({ + nullable: true, + comment: "ประเภทช่วงเวลาการศึกษา", + default: null, + }) + isDate: boolean; + @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; diff --git a/src/migration/1710749867773-update_table_profile_history_add_note.ts b/src/migration/1710749867773-update_table_profile_history_add_note.ts new file mode 100644 index 00000000..1d3cc342 --- /dev/null +++ b/src/migration/1710749867773-update_table_profile_history_add_note.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableProfileHistoryAddNote1710749867773 implements MigrationInterface { + name = 'UpdateTableProfileHistoryAddNote1710749867773' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileEducationHistory\` ADD \`note\` varchar(255) NULL COMMENT 'หมายเหตุ'`); + await queryRunner.query(`ALTER TABLE \`profileInsigniaHistory\` ADD \`note\` varchar(255) NULL COMMENT 'หมายเหตุ'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileInsigniaHistory\` DROP COLUMN \`note\``); + await queryRunner.query(`ALTER TABLE \`profileEducationHistory\` DROP COLUMN \`note\``); + } + +} diff --git a/src/migration/1710752446531-update_table_profile_history_add_is_date.ts b/src/migration/1710752446531-update_table_profile_history_add_is_date.ts new file mode 100644 index 00000000..bc408b1d --- /dev/null +++ b/src/migration/1710752446531-update_table_profile_history_add_is_date.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableProfileHistoryAddIsDate1710752446531 implements MigrationInterface { + name = 'UpdateTableProfileHistoryAddIsDate1710752446531' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileHonorHistory\` ADD \`isDate\` tinyint NULL COMMENT 'ประเภทช่วงเวลาการศึกษา'`); + await queryRunner.query(`ALTER TABLE \`profileTrainingHistory\` ADD \`isDate\` tinyint NULL COMMENT 'ประเภทช่วงเวลาการศึกษา'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileTrainingHistory\` DROP COLUMN \`isDate\``); + await queryRunner.query(`ALTER TABLE \`profileHonorHistory\` DROP COLUMN \`isDate\``); + } + +}