fix ข้อมูลผู้พ้นจากราชการก่อนปี 2568 ระบบไม่เก็บ logs #2383
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m9s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m9s
This commit is contained in:
parent
2864bea92f
commit
a07d436db8
2 changed files with 17 additions and 5 deletions
|
|
@ -8966,13 +8966,13 @@ export class ProfileController extends Controller {
|
|||
"current_holders.orgChild2",
|
||||
"current_holders.orgChild3",
|
||||
"current_holders.orgChild4",
|
||||
"profileSalary",
|
||||
// "profileSalary",
|
||||
"profileEducations",
|
||||
],
|
||||
order: {
|
||||
profileSalary: {
|
||||
order: "DESC",
|
||||
},
|
||||
// profileSalary: {
|
||||
// order: "DESC",
|
||||
// },
|
||||
profileEducations: {
|
||||
level: "ASC",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ async function logMiddleware(req: Request, res: Response, next: NextFunction) {
|
|||
if (req.url.startsWith("/api/v1/org/profile/")) system = "registry";
|
||||
if (req.url.startsWith("/api/v1/org/profile-employee/")) system = "registry";
|
||||
if (req.url.startsWith("/api/v1/org/profile-temp/")) system = "registry";
|
||||
if (req.url.startsWith("/api/v1/org/ex/")) system = "retirement";
|
||||
|
||||
if (req.url.startsWith("/api/v1/org/commandType/admin")) system = "admin";
|
||||
if (req.url.startsWith("/api/v1/org/commandSys/")) system = "admin";
|
||||
|
|
@ -79,6 +80,17 @@ async function logMiddleware(req: Request, res: Response, next: NextFunction) {
|
|||
// Get rootId from token
|
||||
const rootId = req.app.locals.logData?.orgRootDnaId;
|
||||
|
||||
let _msg = data?.message;
|
||||
if (!_msg) {
|
||||
if (res.statusCode >= 500) {
|
||||
_msg = "ไม่สำเร็จ";
|
||||
} else if (res.statusCode >= 400) {
|
||||
_msg = "พบข้อผิดพลาด";
|
||||
} else if (res.statusCode >= 200) {
|
||||
_msg = "สำเร็จ";
|
||||
}
|
||||
}
|
||||
|
||||
if (level === 1 && res.statusCode < 500) return;
|
||||
if (level === 2 && res.statusCode < 400) return;
|
||||
if (level === 3 && res.statusCode < 200) return;
|
||||
|
|
@ -94,7 +106,7 @@ async function logMiddleware(req: Request, res: Response, next: NextFunction) {
|
|||
method: req.method,
|
||||
endpoint: req.url,
|
||||
responseCode: String(res.statusCode === 304 ? 200 : res.statusCode),
|
||||
responseDescription: data?.message,
|
||||
responseDescription: _msg,
|
||||
input: level === 4 ? JSON.stringify(req.body, null, 2) : undefined,
|
||||
output: level === 4 ? JSON.stringify(data, null, 2) : undefined,
|
||||
...req.app.locals.logData,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue