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.
46 lines
1.0 KiB
Python
46 lines
1.0 KiB
Python
"""Pydantic schemas for Notification endpoints."""
|
|
|
|
# Import uuid
|
|
import uuid
|
|
|
|
# Import datetime from datetime
|
|
from datetime import datetime
|
|
|
|
# Import BaseModel, ConfigDict from pydantic
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
|
|
# Define class NotificationOut
|
|
class NotificationOut(BaseModel):
|
|
"""Notification returned by the API."""
|
|
|
|
# id: uuid.UUID
|
|
id: uuid.UUID
|
|
# user_id: uuid.UUID
|
|
user_id: uuid.UUID
|
|
# type: str
|
|
type: str
|
|
# title: str
|
|
title: str
|
|
# Assign message = None
|
|
message: str | None = None
|
|
# Assign entity_type = None
|
|
entity_type: str | None = None
|
|
# Assign entity_id = None
|
|
entity_id: uuid.UUID | None = None
|
|
# Assign read = False
|
|
read: bool = False
|
|
# Assign created_at = None
|
|
created_at: datetime | None = None
|
|
|
|
# Assign model_config = ConfigDict(from_attributes=True)
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
# Define class UnreadCountOut
|
|
class UnreadCountOut(BaseModel):
|
|
"""Simple counter response."""
|
|
|
|
# unread_count: int
|
|
unread_count: int
|