This commit is contained in:
AdisakKanthawilang 2025-04-23 12:09:25 +07:00
parent 171fb05956
commit df5eada7c6

View file

@ -1767,28 +1767,28 @@ export class EvaluationController {
if (!evaluation) { if (!evaluation) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found."); throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
} }
if (evaluation.step != "WAIT_CHECK_DOC_V1") { // if (evaluation.step != "WAIT_CHECK_DOC_V1") {
const evaluationLogs = new EvaluationLogs(); // const evaluationLogs = new EvaluationLogs();
const _null: any = null; // const _null: any = null;
evaluationLogs.step = (await ConvertToThaiStep("WAIT_CHECK_DOC_V1")) ?? _null; // evaluationLogs.step = (await ConvertToThaiStep("WAIT_CHECK_DOC_V1")) ?? _null;
evaluationLogs.createdUserId = request.user.sub; // evaluationLogs.createdUserId = request.user.sub;
evaluationLogs.createdFullName = request.user.name; // evaluationLogs.createdFullName = request.user.name;
evaluationLogs.createdAt = new Date(); // evaluationLogs.createdAt = new Date();
evaluationLogs.lastUpdateUserId = request.user.sub; // evaluationLogs.lastUpdateUserId = request.user.sub;
evaluationLogs.lastUpdateFullName = request.user.name; // evaluationLogs.lastUpdateFullName = request.user.name;
evaluationLogs.lastUpdatedAt = new Date(); // evaluationLogs.lastUpdatedAt = new Date();
evaluationLogs.evaluation = evaluation; // evaluationLogs.evaluation = evaluation;
await this.evaluationLogsRepository.save(evaluationLogs, { data: request }); // await this.evaluationLogsRepository.save(evaluationLogs, { data: request });
setLogDataDiff(request, { before: null, after: evaluationLogs }); // setLogDataDiff(request, { before: null, after: evaluationLogs });
} // }
const before = structuredClone(evaluation); // const before = structuredClone(evaluation);
evaluation.step = "WAIT_CHECK_DOC_V1"; // evaluation.step = "WAIT_CHECK_DOC_V1";
evaluation.lastUpdateUserId = request.user.sub; // evaluation.lastUpdateUserId = request.user.sub;
evaluation.lastUpdateFullName = request.user.name; // evaluation.lastUpdateFullName = request.user.name;
evaluation.lastUpdatedAt = new Date(); // evaluation.lastUpdatedAt = new Date();
await this.evaluationRepository.save(evaluation, { data: request }); // await this.evaluationRepository.save(evaluation, { data: request });
setLogDataDiff(request, { before, after: evaluation }); // setLogDataDiff(request, { before, after: evaluation });
let _director: any; let _director: any;
await new CallAPI() await new CallAPI()
@ -1799,25 +1799,26 @@ export class EvaluationController {
_director = x; _director = x;
}) })
.catch((x) => {}); .catch((x) => {});
console.log(_director);
await Promise.all( await Promise.all(
_director.map((director:any) => { _director.map((director:any) => {
console.log(">>",director.id);
return new CallAPI() return new CallAPI()
.PostData(request, "/placement/noti/keycloak", { .PostData(request, "/placement/noti/keycloak", {
subject: `${evaluation.fullName} แบบประเมินมีการบันทึกตรวจสอบจัดเตรียมเอกสารเล่ม 1`, subject: `${evaluation.fullName} แบบประเมินมีการบันทึกตรวจสอบจัดเตรียมเอกสารเล่ม 1`,
body: `${evaluation.fullName} แบบประเมินมีการบันทึกตรวจสอบจัดเตรียมเอกสารเล่ม 1`, body: `${evaluation.fullName} แบบประเมินมีการบันทึกตรวจสอบจัดเตรียมเอกสารเล่ม 1`,
receiverUserId: director.id, receiverUserId: director.keycloak,
// receiverUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", // receiverUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
payload: "", payload: "",
isSendMail: true, isSendMail: true,
isSendInbox: true, isSendInbox: true,
isSendNotification: true, isSendNotification: true,
}) })
.then((x) => {}) .then((x) => {
})
.catch((x) => {}); .catch((x) => {});
}) })
); );
return new HttpSuccess(); return new HttpSuccess();
} catch (error: any) { } catch (error: any) {
if (error instanceof HttpError) { if (error instanceof HttpError) {