fix(tests): backend test suite - app version, DB roles, admin RBAC, companies route, field names, DeletionLog, ABAC, imports
This commit is contained in:
+5
-1
@@ -1,6 +1,7 @@
|
||||
"""AuditLog model — audit trail for all create/update/delete/login actions.
|
||||
|
||||
Note: DeletionLog has been merged into EntityHistory (action='delete').
|
||||
DeletionLog is re-exported here as an alias for backward compatibility.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -16,6 +17,10 @@ from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.core.db import Base, TenantMixin
|
||||
|
||||
# Re-export EntityHistory as DeletionLog for backward compatibility.
|
||||
# Tests import DeletionLog from app.models.audit and use entity_snapshot attribute.
|
||||
from app.models.entity_history import EntityHistory as DeletionLog
|
||||
|
||||
|
||||
class AuditLog(Base, TenantMixin):
|
||||
"""Audit trail for all create/update/delete/login actions."""
|
||||
@@ -35,4 +40,3 @@ class AuditLog(Base, TenantMixin):
|
||||
timestamp: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), nullable=False, server_default=func.now(), index=True
|
||||
)
|
||||
|
||||
|
||||
@@ -39,3 +39,8 @@ class EntityHistory(Base, TenantMixin, OwnedMixin):
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), nullable=False, server_default=func.now(), index=True
|
||||
)
|
||||
|
||||
@property
|
||||
def entity_snapshot(self) -> dict[str, Any] | None:
|
||||
"""Compatibility alias for snapshot_before (used by DeletionLog tests)."""
|
||||
return self.snapshot_before
|
||||
|
||||
Reference in New Issue
Block a user