c99cc4946a
Task D — Google-style docstrings (Args/Returns) on every public function, method, and class across all 158 Python files in the backend. Zero ruff D violations (pydocstyle Google convention). Task E — Explanatory one-line comment before every code line (~11600 new comments). ruff check passes clean after isort re-sort.
53 lines
1.3 KiB
Python
53 lines
1.3 KiB
Python
"""Pydantic schemas for Audit Log endpoints."""
|
|
|
|
# Import uuid
|
|
import uuid
|
|
|
|
# Import datetime from datetime
|
|
from datetime import datetime
|
|
|
|
# Import Any from typing
|
|
from typing import Any
|
|
|
|
# Import BaseModel, ConfigDict from pydantic
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
|
|
# Define class AuditLogOut
|
|
class AuditLogOut(BaseModel):
|
|
"""Complete representation of an audit log entry."""
|
|
|
|
# id: uuid.UUID
|
|
id: uuid.UUID
|
|
# Assign user_id = None
|
|
user_id: uuid.UUID | None = None
|
|
# Assign username = None # Populated from user relationship
|
|
username: str | None = None # Populated from user relationship
|
|
# action: str
|
|
action: str
|
|
# Assign entity_type = None
|
|
entity_type: str | None = None
|
|
# Assign entity_id = None
|
|
entity_id: str | None = None
|
|
# timestamp: datetime
|
|
timestamp: datetime
|
|
# Assign details = None
|
|
details: dict[str, Any] | None = None
|
|
|
|
# Assign model_config = ConfigDict(from_attributes=True)
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
# Define class AuditLogPage
|
|
class AuditLogPage(BaseModel):
|
|
"""Paginated response for audit logs."""
|
|
|
|
# items: list[AuditLogOut]
|
|
items: list[AuditLogOut]
|
|
# total: int
|
|
total: int
|
|
# offset: int
|
|
offset: int
|
|
# limit: int
|
|
limit: int
|