Watch
1
0
Fork
You've already forked Seyyed_arc
0
forked from hesabix/arc
Seyyed_arc/hesabixAPI/adapters/db/models/admin_audit_log.py
Babak Alizadeh b68a6ab5fa feat: ship CRM enterprise, office automation, and procurement
Add the next office-automation phases, CRM workspace and enterprise flows, and the procurement plugin, with help-center content and admin follow-through.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-10 23:48:01 +03:30

29 lines
1.2 KiB
Python

"""لاگ کارهای مدیر سیستم."""
from __future__ import annotations
from datetime import datetime
from sqlalchemy import BigInteger, DateTime, Index, String, Text
from sqlalchemy.orm import Mapped, mapped_column
from adapters.db.session import Base
class AdminAuditLog(Base):
__tablename__ = "admin_audit_logs"
__table_args__ = (
Index("ix_admin_audit_logs_created", "created_at"),
Index("ix_admin_audit_logs_action_created", "action", "created_at"),
Index("ix_admin_audit_logs_actor", "actor_user_id"),
)
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow, nullable=False)
actor_user_id: Mapped[int | None] = mapped_column(BigInteger, nullable=True)
action: Mapped[str] = mapped_column(String(64), nullable=False)
target_type: Mapped[str | None] = mapped_column(String(64), nullable=True)
target_id: Mapped[str | None] = mapped_column(String(64), nullable=True)
summary: Mapped[str] = mapped_column(String(500), nullable=False)
metadata_json: Mapped[str | None] = mapped_column(Text, nullable=True)
client_ip: Mapped[str | None] = mapped_column(String(64), nullable=True)