- Store subscriber count from YouTube statistics and show it on channel page - Sync 50 videos per channel with playlistItems pagination support - Show per-channel and per-category new-videos counters (2-day window) - Replace hourly videos sync with activity trigger (2h idle) and incremental backfill (hard cap 200 per channel) - Clicking the sidebar new-videos count filters the category feed to recent videos only (new_only) - Update agent-team docs: deploy after green checks
25 lines
1.3 KiB
Python
25 lines
1.3 KiB
Python
from datetime import datetime
|
|
|
|
from sqlalchemy import BigInteger, Boolean, DateTime, String, Text, func
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.db import Base
|
|
|
|
|
|
class Channel(Base):
|
|
__tablename__ = "channels"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
|
youtube_channel_id: Mapped[str] = mapped_column(String(64), unique=True, nullable=False, index=True)
|
|
youtube_subscription_id: Mapped[str | None] = mapped_column(String(64), nullable=True)
|
|
title: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
description: Mapped[str | None] = mapped_column(Text, nullable=True)
|
|
thumbnail_url: Mapped[str | None] = mapped_column(String, nullable=True)
|
|
uploads_playlist_id: Mapped[str | None] = mapped_column(String(64), nullable=True)
|
|
subscriber_count: Mapped[int | None] = mapped_column(BigInteger, nullable=True)
|
|
subscribed: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True)
|
|
last_synced_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
|
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
|
updated_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), server_default=func.now(), onupdate=func.now(), nullable=False
|
|
)
|