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:
2026-03-09 19:29:58 -05:00
parent aaa240dbf0
commit bc2203524f
76 changed files with 7570 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
from datetime import datetime
from fastapi import APIRouter, Depends, Query
from sqlalchemy.ext.asyncio import AsyncSession
from backend.database import get_db
from backend.services import comment_service
router = APIRouter(prefix="/comments", tags=["comments"])
@router.get("")
async def list_comments(
post_id: int | None = None,
subreddit_id: int | None = None,
author: str | None = None,
sort_by: str = Query("created_utc", pattern="^(created_utc|score)$"),
sort_order: str = Query("desc", pattern="^(asc|desc)$"),
since: datetime | None = None,
until: datetime | None = None,
page: int = Query(1, ge=1),
per_page: int = Query(25, ge=1, le=100),
db: AsyncSession = Depends(get_db),
):
comments, total = await comment_service.list_comments(
db, post_id, subreddit_id, author, sort_by, sort_order, since, until, page, per_page
)
return {
"data": comments,
"total": total,
"page": page,
"per_page": per_page,
"pages": (total + per_page - 1) // per_page if per_page else 0,
}