แก้ไข middleware log ให้ใช้จาก token #223
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m21s

This commit is contained in:
harid 2026-03-20 16:55:27 +07:00
parent 251e87d2b2
commit 2fdf5e5854
3 changed files with 224 additions and 221 deletions

View file

@ -67,14 +67,17 @@ async function logMiddleware(req: Request, res: Response, next: NextFunction) {
const level = LOG_LEVEL_MAP[process.env.LOG_LEVEL ?? "debug"] || 4;
// Get profile from cache
const profileByKeycloak = await logMemoryStore.getProfileByKeycloak(
req.app.locals.logData.userId,
);
// // Get profile from cache
// const profileByKeycloak = await logMemoryStore.getProfileByKeycloak(
// req.app.locals.logData.userId,
// );
// Get rootId from cache
const rootId = await logMemoryStore.getRootIdByProfileId(profileByKeycloak?.id);
// console.log("ancestorDNA:", rootId);
// // Get rootId from cache
// const rootId = await logMemoryStore.getRootIdByProfileId(profileByKeycloak?.id);
// // console.log("ancestorDNA:", rootId);
// Get rootId from token
const rootId = req.app.locals.logData?.orgRootDnaId;
if (level === 1 && res.statusCode < 500) return;
if (level === 2 && res.statusCode < 400) return;