from datetime import datetime from pydantic import BaseModel class PostResponse(BaseModel): id: int reddit_id: str subreddit_id: int subreddit_name: str | None = None author_id: int | None author_name: str | None = None title: str selftext: str | None url: str | None permalink: str | None flair: str | None score: int upvote_ratio: float | None num_comments: int is_self: bool | None over_18: bool hot_rank: int | None created_utc: datetime collected_at: datetime updated_at: datetime model_config = {"from_attributes": True} class PostDetailResponse(PostResponse): comments: list["CommentResponse"] = [] class CommentResponse(BaseModel): id: int reddit_id: str post_id: int parent_comment_id: int | None author_id: int | None author_name: str | None = None body: str score: int created_utc: datetime model_config = {"from_attributes": True}