Add Reddit monitoring bot — backend, frontend, and Docker config
Python/FastAPI backend with PostgreSQL for collecting Reddit data via public .json endpoints. React/Vite dashboard for analytics. Docker Compose setup with API and worker services connecting to shared PostgreSQL. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
45
backend/schemas/post.py
Normal file
45
backend/schemas/post.py
Normal file
@@ -0,0 +1,45 @@
|
||||
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}
|
||||
Reference in New Issue
Block a user