Issue 1: repo scaffold and project structure

This commit is contained in:
Johnny 5
2026-06-07 19:20:02 +00:00
parent e0b31009b7
commit a70bdeaa5e
52 changed files with 6750 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
"""Audit log helper. Every state-changing endpoint must call record_audit."""
import json
from typing import Any
from sqlmodel import Session
from ten31portal.models import AuditLog
def record_audit(
session: Session,
actor_user_id: int | None,
action: str,
object_type: str,
object_id: int | None = None,
detail: Any = None,
) -> AuditLog:
"""Write one audit log entry and flush it."""
entry = AuditLog(
actor_user_id=actor_user_id,
action=action,
object_type=object_type,
object_id=object_id,
detail=detail,
)
session.add(entry)
session.flush()
return entry