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,23 @@
from datetime import datetime, timezone
from sqlalchemy import Integer, Float, DateTime, ForeignKey, Index
from sqlalchemy.orm import Mapped, mapped_column, relationship
from backend.models.base import Base
class MetricSnapshot(Base):
__tablename__ = "metric_snapshots"
__table_args__ = (
Index("ix_metric_snapshots_post_snapshot", "post_id", "snapshot_at"),
)
id: Mapped[int] = mapped_column(primary_key=True)
post_id: Mapped[int] = mapped_column(ForeignKey("posts.id"), nullable=False)
score: Mapped[int] = mapped_column(Integer, nullable=False)
num_comments: Mapped[int] = mapped_column(Integer, nullable=False)
upvote_ratio: Mapped[float | None] = mapped_column(Float)
snapshot_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True), default=lambda: datetime.now(timezone.utc)
)
post: Mapped["Post"] = relationship(back_populates="metric_snapshots") # noqa: F821