From 1afe64bdd34203203765ce51d2e740f503412af1 Mon Sep 17 00:00:00 2001 From: AnandaTon Date: Mon, 13 May 2024 17:26:04 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=E0=B8=82=E0=B9=89=E0=B8=AD=E0=B8=A1=E0=B8=B9=E0=B8=A5=E0=B8=A3?= =?UTF-8?q?=E0=B8=B2=E0=B8=8A=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B9=80=E0=B9=80?= =?UTF-8?q?=E0=B8=A5=E0=B8=B0=E0=B8=9A=E0=B8=B1=E0=B8=99=E0=B8=97=E0=B8=B6?= =?UTF-8?q?=E0=B8=81=E0=B9=84=E0=B8=A1=E0=B9=88=E0=B9=84=E0=B8=94=E0=B9=89?= =?UTF-8?q?=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B9=80=E0=B8=87=E0=B8=B4=E0=B8=99?= =?UTF-8?q?=E0=B9=80=E0=B8=94=E0=B8=B7=E0=B8=AD=E0=B8=99=E0=B9=80=E0=B8=9E?= =?UTF-8?q?=E0=B8=B4=E0=B9=88=E0=B8=A1=E0=B9=80=E0=B8=95=E0=B8=B4=E0=B8=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProfileEmployeeDisciplineController.ts | 4 ++-- src/controllers/ProfileEmployeeDutyController.ts | 4 ++-- src/controllers/ProfileEmployeeLeaveController.ts | 4 ++-- .../ProfileEmployeeNopaidController.ts | 11 +++++++++-- src/entities/ProfileDiscipline.ts | 13 +++++++++++-- src/entities/ProfileDuty.ts | 13 +++++++++++-- src/entities/ProfileLeave.ts | 15 +++++++++++++-- src/entities/ProfileNopaid.ts | 12 ++++++++++-- 8 files changed, 60 insertions(+), 16 deletions(-) diff --git a/src/controllers/ProfileEmployeeDisciplineController.ts b/src/controllers/ProfileEmployeeDisciplineController.ts index b311fa27..1f2479cf 100644 --- a/src/controllers/ProfileEmployeeDisciplineController.ts +++ b/src/controllers/ProfileEmployeeDisciplineController.ts @@ -19,7 +19,7 @@ import HttpError from "../interfaces/http-error"; import { ProfileDisciplineHistory } from "../entities/ProfileDisciplineHistory"; import { RequestWithUser } from "../middlewares/user"; import { - CreateProfileDiscipline, + CreateProfileEmployeeDiscipline, ProfileDiscipline, UpdateProfileDiscipline, } from "../entities/ProfileDiscipline"; @@ -114,7 +114,7 @@ export class ProfileDisciplineEmployeeController extends Controller { @Post() public async newDiscipline( @Request() req: RequestWithUser, - @Body() body: CreateProfileDiscipline, + @Body() body: CreateProfileEmployeeDiscipline, ) { if (!body.profileEmployeeId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId"); diff --git a/src/controllers/ProfileEmployeeDutyController.ts b/src/controllers/ProfileEmployeeDutyController.ts index 83c61952..62a42975 100644 --- a/src/controllers/ProfileEmployeeDutyController.ts +++ b/src/controllers/ProfileEmployeeDutyController.ts @@ -19,7 +19,7 @@ import HttpError from "../interfaces/http-error"; import { ProfileDutyHistory } from "../entities/ProfileDutyHistory"; import { RequestWithUser } from "../middlewares/user"; import { ProfileEmployee } from "../entities/ProfileEmployee"; -import { CreateProfileDuty, ProfileDuty, UpdateProfileDuty } from "../entities/ProfileDuty"; +import { CreateProfileEmployeeDuty, ProfileDuty, UpdateProfileDuty } from "../entities/ProfileDuty"; @Route("api/v1/org/profile/duty") @Tags("ProfileDuty") @@ -106,7 +106,7 @@ export class ProfileDutyController extends Controller { } @Post() - public async newDuty(@Request() req: RequestWithUser, @Body() body: CreateProfileDuty) { + public async newDuty(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeDuty) { if (!body.profileEmployeeId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId"); } diff --git a/src/controllers/ProfileEmployeeLeaveController.ts b/src/controllers/ProfileEmployeeLeaveController.ts index bc49b8b9..6cc1c302 100644 --- a/src/controllers/ProfileEmployeeLeaveController.ts +++ b/src/controllers/ProfileEmployeeLeaveController.ts @@ -15,7 +15,7 @@ import { import { AppDataSource } from "../database/data-source"; import { ProfileLeaveHistory, - CreateProfileLeave, + CreateProfileEmployeeLeave, ProfileLeave, UpdateProfileLeave, } from "../entities/ProfileLeave"; @@ -157,7 +157,7 @@ export class ProfileLeaveController extends Controller { } @Post() - public async newLeave(@Request() req: RequestWithUser, @Body() body: CreateProfileLeave) { + public async newLeave(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeLeave) { if (!body.profileEmployeeId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId"); } diff --git a/src/controllers/ProfileEmployeeNopaidController.ts b/src/controllers/ProfileEmployeeNopaidController.ts index 2ac06c90..6868bada 100644 --- a/src/controllers/ProfileEmployeeNopaidController.ts +++ b/src/controllers/ProfileEmployeeNopaidController.ts @@ -19,7 +19,11 @@ import HttpError from "../interfaces/http-error"; import { ProfileNopaidHistory } from "../entities/ProfileNopaidHistory"; import { RequestWithUser } from "../middlewares/user"; import { ProfileEmployee } from "../entities/ProfileEmployee"; -import { CreateProfileNopaid, ProfileNopaid, UpdateProfileNopaid } from "../entities/ProfileNopaid"; +import { + CreateProfileEmployeeNopaid, + ProfileNopaid, + UpdateProfileNopaid, +} from "../entities/ProfileNopaid"; @Route("api/v1/org/profile/nopaid") @Tags("ProfileNopaid") @@ -83,7 +87,10 @@ export class ProfileNopaidController extends Controller { } @Post() - public async newNopaid(@Request() req: RequestWithUser, @Body() body: CreateProfileNopaid) { + public async newNopaid( + @Request() req: RequestWithUser, + @Body() body: CreateProfileEmployeeNopaid, + ) { if (!body.profileEmployeeId) { throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId"); } diff --git a/src/entities/ProfileDiscipline.ts b/src/entities/ProfileDiscipline.ts index 443500da..0c93adf2 100644 --- a/src/entities/ProfileDiscipline.ts +++ b/src/entities/ProfileDiscipline.ts @@ -86,8 +86,17 @@ export class ProfileDiscipline extends EntityBase { export class CreateProfileDiscipline { date: Date | null; - profileId?: string; - profileEmployeeId?: string | null; + profileId: string; + level: string | null; + detail: string | null; + refCommandDate: Date | null; + refCommandNo: string | null; + unStigma: string | null; +} + +export class CreateProfileEmployeeDiscipline { + date: Date | null; + profileEmployeeId: string | null; level: string | null; detail: string | null; refCommandDate: Date | null; diff --git a/src/entities/ProfileDuty.ts b/src/entities/ProfileDuty.ts index 8c7d38ed..455ae4ce 100644 --- a/src/entities/ProfileDuty.ts +++ b/src/entities/ProfileDuty.ts @@ -83,8 +83,17 @@ export class ProfileDuty extends EntityBase { } export class CreateProfileDuty { - profileId?: string | null; - profileEmployeeId?: string | null; + profileId: string | null; + dateStart: Date | null; + dateEnd: Date | null; + detail: string | null; + reference: string | null; + refCommandDate: Date | null; + refCommandNo: string | null; +} + +export class CreateProfileEmployeeDuty { + profileEmployeeId: string | null; dateStart: Date | null; dateEnd: Date | null; detail: string | null; diff --git a/src/entities/ProfileLeave.ts b/src/entities/ProfileLeave.ts index cc44f131..666156d0 100644 --- a/src/entities/ProfileLeave.ts +++ b/src/entities/ProfileLeave.ts @@ -115,9 +115,20 @@ export class ProfileLeaveHistory extends ProfileLeave { } export class CreateProfileLeave { - profileId?: string | null; + profileId: string | null; leaveTypeId: string; - profileEmployeeId?: string | null; + dateLeaveStart: Date | null; + dateLeaveEnd: Date | null; + leaveDays: number | null; + leaveCount: number | null; + totalLeave: number | null; + status: string | null; + reason: string | null; +} + +export class CreateProfileEmployeeLeave { + leaveTypeId: string; + profileEmployeeId: string | null; dateLeaveStart: Date | null; dateLeaveEnd: Date | null; leaveDays: number | null; diff --git a/src/entities/ProfileNopaid.ts b/src/entities/ProfileNopaid.ts index fae00ccf..84246ba0 100644 --- a/src/entities/ProfileNopaid.ts +++ b/src/entities/ProfileNopaid.ts @@ -75,8 +75,16 @@ export class ProfileNopaid extends EntityBase { } export class CreateProfileNopaid { - profileId?: string | null; - profileEmployeeId?: string | null; + profileId: string | null; + date: Date | null; + detail: string | null; + reference: string | null; + refCommandDate: Date | null; + refCommandNo: string | null; +} + +export class CreateProfileEmployeeNopaid { + profileEmployeeId: string | null; date: Date | null; detail: string | null; reference: string | null;