add checkRootDna

This commit is contained in:
Adisak 2026-01-28 18:05:56 +07:00
parent 84dbbf67c3
commit d19fa67cf2
2 changed files with 35 additions and 2 deletions

View file

@ -49,7 +49,7 @@ async function logMiddleware(req: Request, res: Response, next: NextFunction) {
let rootId = null
try {
rootId = token ? await new permission().checkOrg(token, req.app.locals.logData.userId) : null
rootId = token ? await new permission().checkRootDna(token, req.app.locals.logData.userId) : null
} catch (err) {
console.warn("Error fetching rootId:", err)
}
@ -57,7 +57,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: "probation",
startTimeStamp: timestamp,
endTimeStamp: new Date().toISOString(),