From 5f94e6350311fdff78b5fe213d93e0cb4a9f9e8e Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Thu, 9 May 2024 11:41:26 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=E0=B9=80=E0=B8=AA=E0=B9=89=E0=B8=99=20point?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../KpiUserDevelopmentController.ts | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/controllers/KpiUserDevelopmentController.ts b/src/controllers/KpiUserDevelopmentController.ts index 269fb3b..9316ff5 100644 --- a/src/controllers/KpiUserDevelopmentController.ts +++ b/src/controllers/KpiUserDevelopmentController.ts @@ -234,30 +234,30 @@ export class KpiUserDevelopmentController extends Controller { return new HttpSuccess(mapKpiUserDevelopment); } -// /** -// * API กรอกระดับคะแนนงานตามแผนปฏิบัติราชการประจำปี -// * -// * @summary กรอกระดับคะแนนงานตามแผนปฏิบัติราชการประจำปี -// * -// * -// */ -// @Post("point") -// async CreateKpiUserDevelopmentPoint( -// @Body() requestBody: KpiUserDevelopmentDataPoint[], -// @Request() request: { user: Record }, -// ) { -// for (const item of requestBody) { -// const kpiUserDevelopment = await this.kpiUserDevelopmentRepository.findOne({ -// where: { id: item.id }, -// }); -// if (!kpiUserDevelopment) { -// throw new HttpError(HttpStatusCode.NOT_FOUND, `ไม่พบข้อมูลพัฒนาตนเองนี้: ${item.id}`); -// } -// this.kpiUserDevelopmentRepository.merge(kpiUserDevelopment, item); -// kpiUserDevelopment.lastUpdateUserId = request.user.sub; -// kpiUserDevelopment.lastUpdateFullName = request.user.name; -// await this.kpiUserDevelopmentRepository.save(kpiUserDevelopment); -// } -// return new HttpSuccess(); -// } + /** + * API กรอกระดับคะแนนพัฒนาตนเอง + * + * @summary กรอกระดับคะแนนพัฒนาตนเอง + * + * + */ + @Post("point") + async CreateKpiUserDevelopmentPoint( + @Body() requestBody: KpiUserDevelopmentDataPoint[], + @Request() request: { user: Record }, + ) { + for (const item of requestBody) { + const kpiUserDevelopment = await this.kpiUserDevelopmentRepository.findOne({ + where: { id: item.id }, + }); + if (!kpiUserDevelopment) { + throw new HttpError(HttpStatusCode.NOT_FOUND, `ไม่พบข้อมูลพัฒนาตนเองนี้: ${item.id}`); + } + this.kpiUserDevelopmentRepository.merge(kpiUserDevelopment, item); + kpiUserDevelopment.lastUpdateUserId = request.user.sub; + kpiUserDevelopment.lastUpdateFullName = request.user.name; + await this.kpiUserDevelopmentRepository.save(kpiUserDevelopment); + } + return new HttpSuccess(); + } }