ваше сообщение коммита

This commit is contained in:
2025-08-01 16:33:10 +03:00
parent 3ee29f16bd
commit e30d672c52
69 changed files with 690 additions and 2130 deletions

View File

@@ -10,7 +10,7 @@
* GitHub: https://github.com/HB3-ACCELERATOR
*/
console.log('[DIAG][auth.js] Файл загружен:', __filename);
// console.log('[DIAG][auth.js] Файл загружен:', __filename);
const { createError } = require('../utils/error');
const authService = require('../services/auth-service');
@@ -30,14 +30,14 @@ try {
encryptionKey = fs.readFileSync(keyPath, 'utf8').trim();
}
} catch (keyError) {
console.error('Error reading encryption key:', keyError);
// console.error('Error reading encryption key:', keyError);
}
/**
* Middleware для проверки аутентификации
*/
const requireAuth = async (req, res, next) => {
console.log('[DIAG][requireAuth] session:', req.session);
// console.log('[DIAG][requireAuth] session:', req.session);
if (!req.session || !req.session.authenticated) {
return res.status(401).json({ error: 'Требуется аутентификация' });
}
@@ -148,7 +148,7 @@ async function checkRole(req, res, next) {
next();
} catch (error) {
console.error('Error in checkRole middleware:', error);
// console.error('Error in checkRole middleware:', error);
res.status(500).json({ error: 'Internal server error' });
}
}

View File

@@ -18,11 +18,11 @@ const { ERROR_CODES } = require('../utils/constants');
* Middleware для обработки ошибок
*/
const errorHandler = (err, req, res, next) => {
console.log('errorHandler called, arguments:', arguments);
console.log('typeof res:', typeof res, 'isFunction:', typeof res === 'function');
console.error('errorHandler: err =', err);
console.error('errorHandler: typeof err =', typeof err);
console.error('errorHandler: stack =', err && err.stack);
// console.log('errorHandler called, arguments:', arguments);
// console.log('typeof res:', typeof res, 'isFunction:', typeof res === 'function');
// console.error('errorHandler: err =', err);
// console.error('errorHandler: typeof err =', typeof err);
// console.error('errorHandler: stack =', err && err.stack);
// Логируем ошибку
logger.error(`Error: ${err.message}`, {
stack: err.stack,