From df5eada7c68eff2a2a020b4d2e2859ca1eed5137 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Wed, 23 Apr 2025 12:09:25 +0700 Subject: [PATCH] fix --- src/controllers/EvaluationController.ts | 51 +++++++++++++------------ 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/src/controllers/EvaluationController.ts b/src/controllers/EvaluationController.ts index 11c49b9..e8500fe 100644 --- a/src/controllers/EvaluationController.ts +++ b/src/controllers/EvaluationController.ts @@ -1767,28 +1767,28 @@ export class EvaluationController { if (!evaluation) { throw new HttpError(HttpStatusCode.NOT_FOUND, "not found."); } - if (evaluation.step != "WAIT_CHECK_DOC_V1") { - const evaluationLogs = new EvaluationLogs(); - const _null: any = null; - evaluationLogs.step = (await ConvertToThaiStep("WAIT_CHECK_DOC_V1")) ?? _null; - evaluationLogs.createdUserId = request.user.sub; - evaluationLogs.createdFullName = request.user.name; - evaluationLogs.createdAt = new Date(); - evaluationLogs.lastUpdateUserId = request.user.sub; - evaluationLogs.lastUpdateFullName = request.user.name; - evaluationLogs.lastUpdatedAt = new Date(); - evaluationLogs.evaluation = evaluation; - await this.evaluationLogsRepository.save(evaluationLogs, { data: request }); - setLogDataDiff(request, { before: null, after: evaluationLogs }); - } - const before = structuredClone(evaluation); + // if (evaluation.step != "WAIT_CHECK_DOC_V1") { + // const evaluationLogs = new EvaluationLogs(); + // const _null: any = null; + // evaluationLogs.step = (await ConvertToThaiStep("WAIT_CHECK_DOC_V1")) ?? _null; + // evaluationLogs.createdUserId = request.user.sub; + // evaluationLogs.createdFullName = request.user.name; + // evaluationLogs.createdAt = new Date(); + // evaluationLogs.lastUpdateUserId = request.user.sub; + // evaluationLogs.lastUpdateFullName = request.user.name; + // evaluationLogs.lastUpdatedAt = new Date(); + // evaluationLogs.evaluation = evaluation; + // await this.evaluationLogsRepository.save(evaluationLogs, { data: request }); + // setLogDataDiff(request, { before: null, after: evaluationLogs }); + // } + // const before = structuredClone(evaluation); - evaluation.step = "WAIT_CHECK_DOC_V1"; - evaluation.lastUpdateUserId = request.user.sub; - evaluation.lastUpdateFullName = request.user.name; - evaluation.lastUpdatedAt = new Date(); - await this.evaluationRepository.save(evaluation, { data: request }); - setLogDataDiff(request, { before, after: evaluation }); + // evaluation.step = "WAIT_CHECK_DOC_V1"; + // evaluation.lastUpdateUserId = request.user.sub; + // evaluation.lastUpdateFullName = request.user.name; + // evaluation.lastUpdatedAt = new Date(); + // await this.evaluationRepository.save(evaluation, { data: request }); + // setLogDataDiff(request, { before, after: evaluation }); let _director: any; await new CallAPI() @@ -1799,25 +1799,26 @@ export class EvaluationController { _director = x; }) .catch((x) => {}); - + console.log(_director); await Promise.all( _director.map((director:any) => { + console.log(">>",director.id); return new CallAPI() .PostData(request, "/placement/noti/keycloak", { subject: `${evaluation.fullName} แบบประเมินมีการบันทึกตรวจสอบจัดเตรียมเอกสารเล่ม 1`, body: `${evaluation.fullName} แบบประเมินมีการบันทึกตรวจสอบจัดเตรียมเอกสารเล่ม 1`, - receiverUserId: director.id, + receiverUserId: director.keycloak, // receiverUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", payload: "", isSendMail: true, isSendInbox: true, isSendNotification: true, }) - .then((x) => {}) + .then((x) => { + }) .catch((x) => {}); }) ); - return new HttpSuccess(); } catch (error: any) { if (error instanceof HttpError) {