Files
pocketpaw/ee/cloud/models/comment.py
Rohit Kushwaha ff5bb0350a fix: resolve all 394 ruff lint errors
- Auto-fix 155 errors (import sorting, annotations, deprecated imports)
- Format 87 files with ruff format for line length compliance
- Fix 15 F401 unused imports (add __all__ for re-exports, remove truly unused)
- Fix 7 F841 unused variables (prefix with _)
- Fix 2 F821 undefined names (add missing imports)
- Fix 3 E402 module-level imports not at top
- Fix 2 UP042 str+Enum → StrEnum
- Fix 1 E712 == False comparison
- Fix remaining 51 E501 line-too-long in string literals and expressions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 10:08:58 +05:30

40 lines
975 B
Python

"""Comment document — threaded comments on pockets."""
from __future__ import annotations
from beanie import Indexed
from pydantic import BaseModel, Field
from ee.cloud.models.base import TimestampedDocument
class CommentTarget(BaseModel):
type: str = Field(pattern="^(pocket|widget|agent)$")
pocket_id: str
widget_id: str | None = None
class CommentAuthor(BaseModel):
id: str
name: str
avatar: str = ""
class Comment(TimestampedDocument):
"""Threaded comment on a pocket or widget."""
workspace: Indexed(str) # type: ignore[valid-type]
target: CommentTarget
thread: str | None = None # Parent comment ID for replies
author: CommentAuthor
body: str
mentions: list[str] = Field(default_factory=list) # User IDs
resolved: bool = False
resolved_by: str | None = None
class Settings:
name = "comments"
indexes = [
[("target.pocket_id", 1), ("created_at", -1)],
]