From c0f6c5ab9d85cd511fa61ebee7f68c246e5f558f Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Thu, 4 Apr 2024 17:20:44 +0700 Subject: [PATCH] fix entity and api --- .../DevelopmentEmployeeHistoryController.ts | 4 +- .../DevelopmentHistoryController.ts | 4 +- src/entities/DevelopmentScholarship.ts | 218 ++++++++++++++---- 3 files changed, 183 insertions(+), 43 deletions(-) diff --git a/src/controllers/DevelopmentEmployeeHistoryController.ts b/src/controllers/DevelopmentEmployeeHistoryController.ts index 2b1f386..d0ab136 100644 --- a/src/controllers/DevelopmentEmployeeHistoryController.ts +++ b/src/controllers/DevelopmentEmployeeHistoryController.ts @@ -295,7 +295,7 @@ export class DevelopmentEmployeeHistoryController extends Controller { async GetDevelopemtHistoryById(@Path() id: string) { const type = "EMPLOYEE"; const getDevelopment = await this.developmentHistoryRepository.findOne({ - relations: ["development"], + relations: ["development","employeePosLevel","employeePosType"], where: { id: id, type: type }, }); if (!getDevelopment) { @@ -310,7 +310,9 @@ export class DevelopmentEmployeeHistoryController extends Controller { citizenId: getDevelopment.citizenId ? getDevelopment.citizenId : null, position: getDevelopment.position ? getDevelopment.position : null, posLevelId: getDevelopment.employeePosLevelId ? getDevelopment.employeePosLevelId : null, + posLevelName: getDevelopment.employeePosLevel.posLevelName ? getDevelopment.employeePosLevel.posLevelName : null, posTypeId: getDevelopment.employeePosTypeId ? getDevelopment.employeePosTypeId : null, + posTypeName: getDevelopment.employeePosType.posTypeName ? getDevelopment.employeePosType.posTypeName : null, developmentId: getDevelopment.developmentId ? getDevelopment.developmentId : null, order: getDevelopment.order ? getDevelopment.order : null, dateOrder: getDevelopment.dateOrder ? getDevelopment.dateOrder : null, diff --git a/src/controllers/DevelopmentHistoryController.ts b/src/controllers/DevelopmentHistoryController.ts index f00ad71..ea8f9cc 100644 --- a/src/controllers/DevelopmentHistoryController.ts +++ b/src/controllers/DevelopmentHistoryController.ts @@ -291,7 +291,7 @@ export class DevelopmentOfficerHistoryController extends Controller { async GetDevelopemtHistoryById(@Path() id: string) { const type = "OFFICER"; const getDevelopment = await this.developmentHistoryRepository.findOne({ - relations: ["development"], + relations: ["development","posLevel","posType"], where: { id: id, type: type }, }); if (!getDevelopment) { @@ -306,7 +306,9 @@ export class DevelopmentOfficerHistoryController extends Controller { citizenId: getDevelopment.citizenId ? getDevelopment.citizenId : null, position: getDevelopment.position ? getDevelopment.position : null, posLevelId: getDevelopment.posLevelId ? getDevelopment.posLevelId : null, + posLevelName: getDevelopment.posLevel.posLevelName ? getDevelopment.posLevel.posLevelName : null, posTypeId: getDevelopment.posTypeId ? getDevelopment.posTypeId : null, + posTypeName: getDevelopment.posType.posTypeName ? getDevelopment.posType.posTypeName : null, developmentId: getDevelopment.developmentId ? getDevelopment.developmentId : null, order: getDevelopment.order ? getDevelopment.order : null, dateOrder: getDevelopment.dateOrder ? getDevelopment.dateOrder : null, diff --git a/src/entities/DevelopmentScholarship.ts b/src/entities/DevelopmentScholarship.ts index 29700e2..fe2a478 100644 --- a/src/entities/DevelopmentScholarship.ts +++ b/src/entities/DevelopmentScholarship.ts @@ -3,7 +3,6 @@ import { EntityBase } from "./base/Base"; @Entity("developmentScholarship") export class DevelopmentScholarship extends EntityBase { - @Column({ nullable: true, comment: "ยศ", @@ -238,7 +237,134 @@ export class DevelopmentScholarship extends EntityBase { }) reportBackDate: Date; - //เพิ่มต่อจากนี้ + @Column({ + //ปริญญาตรี = BACHELOR , ปริญญาโท = GRADUATE , ปริญญาเอก = MASTER , ปริญญาดุษฎีบัณฑิต = DOCTOR + nullable: true, + comment: "ระดับปริญญา", + length: 10, + default: null, + }) + degreeLevel: string; + + @Column({ + nullable: true, + comment: "หลักสูตรการศึกษา", + length: 255, + default: null, + }) + courseOfStudy: string; + + @Column({ + nullable: true, + comment: "สาขาวิชา", + length: 255, + default: null, + }) + fieldOfStudy: string; + + @Column({ + nullable: true, + comment: "คณะ", + length: 255, + default: null, + }) + faculty: string; + + @Column({ + nullable: true, + comment: "สถาบันการศึกษา", + length: 255, + default: null, + }) + educationalInstitution: string; + + @Column({ + nullable: true, + comment: "วันเริ่มต้นการศึกษา", + length: 255, + default: null, + }) + studyStartDate: string; + + @Column({ + nullable: true, + comment: "วันสิ้นสุดการศึกษา", + length: 255, + default: null, + }) + studyEndDate: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "สถานที่ไปศึกษาดูงาน", + default: null, + }) + studyTourPlace: Date; + + @Column({ + nullable: true, + type: "datetime", + comment: "หัวข้อการไปศึกษาดูงาน", + default: null, + }) + studyTourTopic: Date; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันเริ่มต้นการศึกษาดูงาน", + default: null, + }) + studyTourStartDate: Date; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันสิ้นสุดการศึกษาดูงาน", + default: null, + }) + studyTourEndDate: Date; + + @Column({ + nullable: true, + comment: "ประเทศที่เดินทางไปศึกษาดูงาน", + length: 255, + default: null, + }) + studyTourCountry: string; + + @Column({ + nullable: true, + comment: "หัวข้อการไปศึกษาดูงานต่างประเทศ", + length: 255, + default: null, + }) + studyTourAbroadTopic: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันเริ่มต้นการศึกษาดูงานต่างประเทศ", + default: null, + }) + studyTourAbroadStartDate: Date; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันสิ้นสุดการศึกษาดูงานต่างประเทศ", + default: null, + }) + studyTourAbroadEndDate: Date; + + @Column({ + nullable: true, + comment: "รวมระยะเวลาในการศึกษา", + length: 40, + default: null, + }) + totalStudyPeriod: string; @Column({ nullable: true, @@ -248,18 +374,10 @@ export class DevelopmentScholarship extends EntityBase { }) trainingCourseName: string; - @Column({ - nullable: true, - comment: "สถาบันการศึกษา/หน่วยงานผู้จัดการฝึกอบรม", - length: 255, - default: null, - }) - trainingplaceName: string; - @Column({ nullable: true, type: "date", - comment: "วันที่เริ่มต้นการฝึกอบรม", + comment: "วันเริ่มต้นการฝึกอบรม", default: null, }) trainingStartDate: Date; @@ -267,26 +385,18 @@ export class DevelopmentScholarship extends EntityBase { @Column({ nullable: true, type: "date", - comment: "วันที่สิ้นสุดการฝึกอบรม", + comment: "วันสิ้นสุดการฝึกอบรม", default: null, }) trainingEndDate: Date; @Column({ nullable: true, - type: "datetime", - comment: "สถานที่ศึกษาดูงาน", + comment: "รวมระยะเวลาในการฝึกอบรม", + length: 40, default: null, }) - studyTourPlace: Date; - - @Column({ - nullable: true, - type: "datetime", - comment: "หัวข้อไปศึกษาดูงาน", - default: null, - }) - studyTourTopic: Date; + totalTrainingTime: string; @Column({ nullable: true, @@ -304,7 +414,7 @@ export class DevelopmentScholarship extends EntityBase { }) dateOrder: Date; } -export class CreateDevelopmentHistory { +export class CreateDevelopmentScholarship { rank: string | null; prefix: string | null; firstName: string | null; @@ -312,7 +422,6 @@ export class CreateDevelopmentHistory { citizenId: string | null; position: string | null; posExecutive: string | null; - guarantorType: string | null; guarantorRank: string | null; guarantorPrefix: string | null; guarantorFirstName: string | null; @@ -324,7 +433,7 @@ export class CreateDevelopmentHistory { budgetSource: string | null; budgetApprove: Double | null; bookNo: string | null; - bookDate: Date | null; + bookNoDate: Date | null; bookApproveDate: Date | null; useOfficialTime: boolean | null; changeDetail: string | null; @@ -335,17 +444,31 @@ export class CreateDevelopmentHistory { reportBackNo: string | null; reportBackNoDate: Date | null; reportBackDate: Date | null; - trainingCourseName: string | null; - trainingplaceName: string | null; - trainingStartDate: Date | null; - trainingEndtDate: Date | null; - order: string | null; - dateOrder: Date | null; + degreeLevel: string | null; + courseOfStudy: string | null; + fieldOfStudy: string | null; + faculty: string | null; + educationalInstitution: string | null; + studyStartDate: string | null; + studyEndDate: string | null; studyTourPlace: Date | null; studyTourTopic: Date | null; + studyTourStartDate: Date | null; + studyTourEndDate: Date | null; + studyTourCountry: string | null; + studyTourAbroadTopic: string | null; + studyTourAbroadStartDate: Date | null; + studyTourAbroadEndDate: Date | null; + totalStudyPeriod: string | null; + trainingCourseName: string | null; + trainingStartDate: Date | null; + trainingEndDate: Date | null; + totalTrainingTime: string | null; + order: string | null; + dateOrder: Date | null; } -export class UpdateDevelopmentHistory { +export class UpdateDevelopmentScholarship { rank: string | null; prefix: string | null; firstName: string | null; @@ -353,7 +476,6 @@ export class UpdateDevelopmentHistory { citizenId: string | null; position: string | null; posExecutive: string | null; - guarantorType: string | null; guarantorRank: string | null; guarantorPrefix: string | null; guarantorFirstName: string | null; @@ -365,7 +487,7 @@ export class UpdateDevelopmentHistory { budgetSource: string | null; budgetApprove: Double | null; bookNo: string | null; - bookDate: Date | null; + bookNoDate: Date | null; bookApproveDate: Date | null; useOfficialTime: boolean | null; changeDetail: string | null; @@ -376,12 +498,26 @@ export class UpdateDevelopmentHistory { reportBackNo: string | null; reportBackNoDate: Date | null; reportBackDate: Date | null; - trainingCourseName: string | null; - trainingplaceName: string | null; - trainingStartDate: Date | null; - trainingEndtDate: Date | null; - order: string | null; - dateOrder: Date | null; + degreeLevel: string | null; + courseOfStudy: string | null; + fieldOfStudy: string | null; + faculty: string | null; + educationalInstitution: string | null; + studyStartDate: string | null; + studyEndDate: string | null; studyTourPlace: Date | null; studyTourTopic: Date | null; + studyTourStartDate: Date | null; + studyTourEndDate: Date | null; + studyTourCountry: string | null; + studyTourAbroadTopic: string | null; + studyTourAbroadStartDate: Date | null; + studyTourAbroadEndDate: Date | null; + totalStudyPeriod: string | null; + trainingCourseName: string | null; + trainingStartDate: Date | null; + trainingEndDate: Date | null; + totalTrainingTime: string | null; + order: string | null; + dateOrder: Date | null; }