feat(refactor): PEP8, type annotations, docstrings and PyJWT security fix
This commit is contained in:
@@ -1,31 +1,48 @@
|
||||
"""Pydantic schemas for Audit Log endpoints."""
|
||||
|
||||
# Import uuid
|
||||
import uuid
|
||||
|
||||
# Import datetime from datetime
|
||||
from datetime import datetime
|
||||
from typing import Any, Optional
|
||||
|
||||
# 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: Optional[datetime] = 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
|
||||
|
||||
Reference in New Issue
Block a user