feat: initialize full-stack architecture with backend routes, database schema, and glassmorphic frontend UI
This commit is contained in:
17
backend/utils/audit_utils.py
Normal file
17
backend/utils/audit_utils.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import json
|
||||
from ..db import get_db_connection, release_db_connection
|
||||
|
||||
def log_action(user_id, action, details=None):
|
||||
"""Записывает действие пользователя в лог аудита."""
|
||||
conn = get_db_connection()
|
||||
try:
|
||||
cur = conn.cursor()
|
||||
cur.execute(
|
||||
"INSERT INTO audit_log (user_id, action, details) VALUES (%s, %s, %s)",
|
||||
(user_id, action, json.dumps(details) if details else None)
|
||||
)
|
||||
conn.commit()
|
||||
except Exception as e:
|
||||
print(f"Audit Log Error: {e}")
|
||||
finally:
|
||||
release_db_connection(conn)
|
||||
Reference in New Issue
Block a user