Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
Algunos registros de audit_log tienen timestamp=NULL en DB. AuditLogOut tenia timestamp: datetime (no opcional) causando ValidationError -> 500 Internal Server Error al listar el audit log. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
32 lines
755 B
Python
32 lines
755 B
Python
"""Pydantic schemas for Audit Log endpoints."""
|
|
|
|
import uuid
|
|
from datetime import datetime
|
|
from typing import Any, Optional
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
|
|
class AuditLogOut(BaseModel):
|
|
"""Complete representation of an audit log entry."""
|
|
|
|
id: uuid.UUID
|
|
user_id: uuid.UUID | None = None
|
|
username: str | None = None # Populated from user relationship
|
|
action: str
|
|
entity_type: str | None = None
|
|
entity_id: str | None = None
|
|
timestamp: Optional[datetime] = None
|
|
details: dict[str, Any] | None = None
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class AuditLogPage(BaseModel):
|
|
"""Paginated response for audit logs."""
|
|
|
|
items: list[AuditLogOut]
|
|
total: int
|
|
offset: int
|
|
limit: int
|