updated pages

This commit is contained in:
2025-07-16 16:08:40 +03:00
parent 94fad22d85
commit f075cdf871
12 changed files with 1808 additions and 26 deletions

View File

@@ -4,6 +4,14 @@ Server log model for audit trail
from app.extensions import db
import datetime
import pytz
# Get local timezone
LOCAL_TZ = pytz.timezone('Europe/Bucharest') # Adjust this to your local timezone
def get_local_time():
"""Get current local time"""
return datetime.datetime.now(LOCAL_TZ).replace(tzinfo=None)
class ServerLog(db.Model):
"""Server log model for tracking system actions"""
@@ -13,7 +21,7 @@ class ServerLog(db.Model):
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=True)
ip_address = db.Column(db.String(45), nullable=True) # Support IPv6
user_agent = db.Column(db.Text, nullable=True)
timestamp = db.Column(db.DateTime, default=datetime.datetime.utcnow, index=True)
timestamp = db.Column(db.DateTime, default=get_local_time, index=True)
level = db.Column(db.String(20), default='INFO') # INFO, WARNING, ERROR, DEBUG
# Relationships