fix(qa): resolver diagnosticos estaticos, sincronizacion moodle y actualizar docs v3.6.4
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from app import db
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
|
||||
class AuditLog(db.Model):
|
||||
"""
|
||||
@@ -16,22 +16,22 @@ class AuditLog(db.Model):
|
||||
entity_id = db.Column(db.Integer, nullable=True) # ID del registro afectado
|
||||
details = db.Column(db.Text, nullable=True) # Detalles de cambios o parámetros
|
||||
ip_address = db.Column(db.String(45), nullable=True) # Soporta IPv4 e IPv6
|
||||
created_at = db.Column(db.DateTime, default=datetime.utcnow, nullable=False, index=True)
|
||||
created_at = db.Column(db.DateTime, default=lambda: datetime.now(timezone.utc).replace(tzinfo=None), nullable=False, index=True)
|
||||
|
||||
# Relación con usuario
|
||||
user = db.relationship('User', foreign_keys=[user_id], backref=db.backref('audit_records', lazy='dynamic'))
|
||||
|
||||
def __init__(self, user_id=None, user_email=None, action=None, module=None, entity_id=None, details=None, ip_address=None, **kwargs):
|
||||
super().__init__(
|
||||
user_id=user_id,
|
||||
user_email=user_email,
|
||||
action=action,
|
||||
module=module,
|
||||
entity_id=entity_id,
|
||||
details=details,
|
||||
ip_address=ip_address,
|
||||
**kwargs
|
||||
)
|
||||
super().__init__()
|
||||
self.user_id = user_id
|
||||
self.user_email = user_email
|
||||
self.action = action
|
||||
self.module = module
|
||||
self.entity_id = entity_id
|
||||
self.details = details
|
||||
self.ip_address = ip_address
|
||||
for k, v in kwargs.items():
|
||||
setattr(self, k, v)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<AuditLog #{self.id} {self.action} on {self.module} by {self.user_email or 'System'}>"
|
||||
|
||||
Reference in New Issue
Block a user