sale order
SAP-ERP Portal CI/CD / build (push) Successful in 3m57s

This commit is contained in:
John
2026-10-05 18:45:17 +05:30
parent e725a6571b
commit eead8f5ffd
129 changed files with 14252 additions and 452 deletions
+3 -1
View File
@@ -138,7 +138,9 @@ module.exports = async function auditLogger(req, res, next) {
try {
let u = {};
try { const tok = getToken(req); if (tok) u = jwt.verify(tok, SECRET) || {}; } catch (_e) {}
let username = u.username || u.name || (req.body && req.body.username) || '';
// req.auditActor: set by routes whose callers aren't ERP users (Sales
// customer portal "customer:<code>", Sales external API).
let username = u.username || u.name || req.auditActor || (req.body && (req.body.username || (String(req.originalUrl || '').startsWith('/api/sales-portal/login') && req.body.cardCode ? `customer:${req.body.cardCode}` : ''))) || '';
let role = u.role || '';
if (!username && u.id) { try { const full = await require('../services/hanaUsers').findById(u.id); if (full) { username = full.username; role = role || full.role; } } catch (_e) {} }
if (!username) username = '(anonymous)';