diff --git a/src/controllers/EvaluationController.ts b/src/controllers/EvaluationController.ts index e8500fe..1ae1d81 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,16 +1799,13 @@ 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.keycloak, - // receiverUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", payload: "", isSendMail: true, isSendInbox: true,