fix remove await and addLogSequence of exprofile system
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m27s

This commit is contained in:
Warunee Tamkoo 2026-03-19 11:13:27 +07:00
parent 66d8ba089d
commit ff752da7dd
5 changed files with 186 additions and 171 deletions

View file

@ -14,6 +14,7 @@ import {
} from "tsoa";
import HttpError from "../interfaces/http-error";
import HttpStatusCode from "../interfaces/http-status";
import { addLogSequence } from "../interfaces/utils";
interface CachedToken {
token: string;
@ -171,6 +172,7 @@ async function getToken(ClientID: string, ClientSecret: string): Promise<string>
// function post retire data to exprofile system
export async function PostRetireToExprofile(
request: any,
citizenID: string,
prefix: string,
firstName: string,
@ -225,19 +227,6 @@ export async function PostRetireToExprofile(
},
});
// addLogSequence(request, {
// action: "request",
// status: "success",
// description: "connected",
// request: {
// method: "POST",
// url: url,
// payload: JSON.stringify(sendData),
// response: JSON.stringify(response.data.result),
// },
// });
return res.data;
} catch (error: any) {
if (error.response?.status === 500 && retryCount < maxRetries - 1) {
@ -245,6 +234,18 @@ export async function PostRetireToExprofile(
retryCount++;
continue;
}
addLogSequence(request, {
action: "request",
status: "error",
description: "unconnected to exprofile api",
request: {
method: "POST",
url: API_URL_BANGKOK + "/importData",
response: JSON.stringify(error),
},
});
throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, "ไม่สามารถติดต่อ API ได้");
}
}