feat: activity log model + API (audit trail)
This commit is contained in:
15
app/models/activity.py
Normal file
15
app/models/activity.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from sqlalchemy import Column, Integer, String, Text, DateTime, ForeignKey
|
||||
from sqlalchemy.sql import func
|
||||
from app.core.config import Base
|
||||
|
||||
|
||||
class ActivityLog(Base):
|
||||
__tablename__ = "activity_logs"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
action = Column(String(50), nullable=False) # e.g. "issue.created", "comment.added"
|
||||
entity_type = Column(String(50), nullable=False) # "issue", "project", "comment"
|
||||
entity_id = Column(Integer, nullable=False)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), nullable=True)
|
||||
details = Column(Text, nullable=True) # JSON string
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
Reference in New Issue
Block a user