add checkRootDna

This commit is contained in:
Adisak 2026-01-28 18:01:56 +07:00
parent 7252da3f1b
commit 884236052e
2 changed files with 35 additions and 2 deletions

View file

@ -50,7 +50,7 @@ async function logMiddleware(req: Request, res: Response, next: NextFunction) {
try {
rootId = token
? await new permission().checkOrg(token, req.app.locals.logData.userId)
? await new permission().checkRootDna(token, req.app.locals.logData.userId)
: null;
} catch (err) {
console.warn("Error fetching rootId:", err);
@ -59,7 +59,7 @@ async function logMiddleware(req: Request, res: Response, next: NextFunction) {
const obj = {
logType: res.statusCode >= 500 ? "error" : res.statusCode >= 400 ? "warning" : "info",
ip: req.ip,
rootId: rootId?.orgRootId ?? null,
rootId: rootId?.rootDnaId ?? null,
systemName: "KPI",
startTimeStamp: timestamp,
endTimeStamp: new Date().toISOString(),