All checks were successful
ci/woodpecker/pr/pipeline Pipeline was successful
Implement full comments system: domain entities (Comment, CommentLike), value objects (CommentContent), use cases (CRUD, like toggle), SQLAlchemy repository, API v1 endpoints, web UI with comment form and nested replies, i18n translations (EN/RU/FR/DE), and E2E tests. Fix nested reply (reply-to-reply) not displaying — the flat reply_comments dict was only queried for top-level comment IDs, so deeply nested replies were saved to DB (incrementing comment count) but never rendered. Switch to a recursive Jinja2 macro that renders any nesting depth.
41 lines
987 B
Python
41 lines
987 B
Python
"""Domain entity for CommentLike.
|
|
|
|
This module defines the CommentLike entity that tracks which users
|
|
have liked which comments.
|
|
"""
|
|
|
|
from dataclasses import dataclass
|
|
from typing import Any
|
|
from uuid import UUID
|
|
|
|
from app.domain.entities.base import BaseEntity
|
|
|
|
|
|
@dataclass(kw_only=True)
|
|
class CommentLike(BaseEntity):
|
|
"""Comment like domain entity.
|
|
|
|
Tracks a like on a comment by a user. Each like is uniquely
|
|
identified by its entity ID.
|
|
|
|
Attributes:
|
|
comment_id: UUID of the liked comment.
|
|
liked_by: Identifier of the user who liked.
|
|
"""
|
|
|
|
comment_id: UUID
|
|
liked_by: str
|
|
|
|
def to_dict(self) -> dict[str, Any]:
|
|
"""Convert entity to dictionary.
|
|
|
|
Returns:
|
|
Dictionary with all CommentLike attributes.
|
|
"""
|
|
return {
|
|
"id": str(self.id),
|
|
"comment_id": str(self.comment_id),
|
|
"liked_by": self.liked_by,
|
|
"created_at": self.created_at.isoformat(),
|
|
}
|