Added comment functionality

This commit is contained in:
gulimabr
2025-12-02 10:28:48 -03:00
parent e152c07f65
commit 0e30db3c18
9 changed files with 1041 additions and 10 deletions

View File

@@ -309,3 +309,45 @@ class RequirementSearchResult(BaseModel):
class Config:
from_attributes = True
# Comment schemas
class CommentReplyResponse(BaseModel):
"""Response schema for a comment reply."""
id: int
reply_text: str
created_at: Optional[datetime] = None
updated_at: Optional[datetime] = None
author_id: Optional[int] = None
author_username: Optional[str] = None
author_full_name: Optional[str] = None
author_role: Optional[str] = None
class Config:
from_attributes = True
class CommentResponse(BaseModel):
"""Response schema for a comment with its replies."""
id: int
comment_text: str
created_at: Optional[datetime] = None
updated_at: Optional[datetime] = None
author_id: Optional[int] = None
author_username: Optional[str] = None
author_full_name: Optional[str] = None
author_role: Optional[str] = None
replies: List[CommentReplyResponse] = []
class Config:
from_attributes = True
class CommentCreateRequest(BaseModel):
"""Request schema for creating a comment."""
comment_text: str
class ReplyCreateRequest(BaseModel):
"""Request schema for creating a reply."""
reply_text: str