phase-2: asset register, detail overview, asset picker, attachments

This commit is contained in:
Atharv1705
2026-11-12 12:38:50 +05:30
parent e58232a657
commit ee437e3adf
27 changed files with 4442 additions and 14 deletions
+25
View File
@@ -0,0 +1,25 @@
import json
from typing import Any
from sqlalchemy.orm import Session
from ..core.time_utils import utc_now
from ..models.system import AuditLog
def log_audit(
db: Session,
entity_type: str,
entity_id: int,
action: str,
changes: dict[str, Any],
user_id: int | None,
) -> AuditLog:
entry = AuditLog(
entity_type=entity_type,
entity_id=entity_id,
action=action,
changes_json=json.dumps(changes, default=str),
by_user_id=user_id,
at=utc_now(),
)
db.add(entry)
return entry