Spaces:
Paused

miracle / models /audit_log.py
dushyantsingh0
fix: resolve typescript build errors in internal portal navigation
b0867f8
Raw History Blame Contribute Delete
882 Bytes
from sqlalchemy import Column, String, ForeignKey
from sqlalchemy.dialects.postgresql import UUID, JSONB
from core.database import Base
from models.base import PrimaryKeyMixin, TimestampMixin
class AuditLog(Base, PrimaryKeyMixin, TimestampMixin):
__tablename__ = "audit_logs"
workspace_id = Column(UUID(as_uuid=True), ForeignKey("workspaces.id"), nullable=True, index=True)
entity_type = Column(String(50), nullable=False, index=True) # e.g., "ticket"
entity_id = Column(UUID(as_uuid=True), nullable=False, index=True)
action = Column(String(100), nullable=False) # e.g., "status_change", "reassignment"
user_id = Column(UUID(as_uuid=True), ForeignKey("users.id"), nullable=True) # NULL if system/AI
old_value = Column(JSONB, nullable=True)
new_value = Column(JSONB, nullable=True)
metadata_json = Column(JSONB, nullable=True, default={})