diff --git a/src/controllers/ProfileGovernmentEmployeeController.ts b/src/controllers/ProfileGovernmentEmployeeController.ts index b84718ee..7613fdc3 100644 --- a/src/controllers/ProfileGovernmentEmployeeController.ts +++ b/src/controllers/ProfileGovernmentEmployeeController.ts @@ -1,11 +1,28 @@ -import { Body, Controller, Example, Get, Patch, Path, Delete, Post, Request, Route, Security, Tags } from "tsoa"; +import { + Body, + Controller, + Example, + Get, + Patch, + Path, + Delete, + Post, + Request, + Route, + Security, + Tags, +} from "tsoa"; import { AppDataSource } from "../database/data-source"; import HttpSuccess from "../interfaces/http-success"; import HttpStatus from "../interfaces/http-status"; import HttpError from "../interfaces/http-error"; import { RequestWithUser } from "../middlewares/user"; import { ProfileEmployee } from "../entities/ProfileEmployee"; -import { CreateProfileEmployeeGovernment, ProfileGovernment, UpdateProfileGovernment } from "../entities/ProfileGovernment"; +import { + CreateProfileEmployeeGovernment, + ProfileGovernment, + UpdateProfileGovernment, +} from "../entities/ProfileGovernment"; import { EmployeePosition } from "../entities/EmployeePosition"; import { EmployeePosMaster } from "../entities/EmployeePosMaster"; import { calculateAge, calculateRetireDate } from "../interfaces/utils"; @@ -95,6 +112,14 @@ export class ProfileGovernmentEmployeeController extends Controller { posMasterNo: posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`, //เลขที่ตำแหน่ง posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate), //วันเกษียณ + dateAppoint: record.dateAppoint, //วันที่สั่งบรรจุ + dateStart: record.dateStart, //วันที่เริ่มปฎิบัติงานราชการ + reasonSameDate: record.reasonSameDate, //เหตุผลที่วันที่ไม่ตรงกัน + dateRetire: record.dateRetire ?? null, //วันครบเกษียณอายุ + govAge: record.dateStart == null ? null : calculateAge(record.dateStart), //อายุราชการ + govAgeAbsent: record.govAgeAbsent ?? null, // ขาดราชการ + govAgePlus: record.govAgePlus, // อายุราชการเกื้อกูล + dateRetireLaw: record.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย }; return new HttpSuccess(data); } @@ -185,4 +210,4 @@ export class ProfileGovernmentEmployeeController extends Controller { // } // return new HttpSuccess(); // } -} \ No newline at end of file +} diff --git a/src/entities/ProfileEmployee.ts b/src/entities/ProfileEmployee.ts index 6dcc648a..c291722e 100644 --- a/src/entities/ProfileEmployee.ts +++ b/src/entities/ProfileEmployee.ts @@ -45,6 +45,44 @@ export class ProfileEmployee extends EntityBase { }) avatarName: string; + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่บรรจุ", + default: null, + }) + dateAppoint: Date; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่เริ่มปฏิบัติราชการ", + default: null, + }) + dateStart: Date; + + @Column({ + nullable: true, + comment: "ขาดราชการ", + default: null, + }) + govAgeAbsent: number; + + @Column({ + nullable: true, + comment: "อายุราชการเกื้อกูล", + default: null, + }) + govAgePlus: number; + + @Column({ + nullable: true, + comment: "เหตุผลกรณีวันไม่ตรงกัน", + length: 255, + default: null, + }) + reasonSameDate: string; + @Column({ nullable: true, comment: "ประเภทลูกจ้าง (perm->ลูกจ้างประจำ temp->ลูกจ้างชั่วคราว)",