chore: initial project setup with backend, frontend, CI/CD, and documentation
Add complete NexaFabric project structure including: - FastAPI backend with SQLAlchemy models, JWT auth, RBAC, audit logging, and provider interfaces - React + TypeScript frontend with Vite, Tailwind CSS, TanStack Query, and Zustand - Docker Compose configuration for PostgreSQL, Redis, API, worker, frontend, and nginx - GitHub Actions and GitLab CI workflows for testing, linting, building, and security scanning - Environment
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.models.domain import AuditLog
|
||||
|
||||
|
||||
def write_audit(
|
||||
db: Session,
|
||||
*,
|
||||
action: str,
|
||||
object_type: str,
|
||||
object_id: str | None = None,
|
||||
user_id: str | None = None,
|
||||
old_values: dict | None = None,
|
||||
new_values: dict | None = None,
|
||||
result: str = "success",
|
||||
error_text: str | None = None,
|
||||
) -> AuditLog:
|
||||
audit = AuditLog(
|
||||
action=action,
|
||||
object_type=object_type,
|
||||
object_id=object_id,
|
||||
user_id=user_id,
|
||||
old_values=old_values,
|
||||
new_values=new_values,
|
||||
result=result,
|
||||
error_text=error_text,
|
||||
)
|
||||
db.add(audit)
|
||||
db.commit()
|
||||
db.refresh(audit)
|
||||
return audit
|
||||
|
||||
Reference in New Issue
Block a user