feat(notifications): durable per-user inbox (P1) + maintenance schema
Add a server-backed notification center that coexists with the client-side transient bell: a per-user `notifications` table (type/title/body/data JSON/ read/dismissed), a `/api/me/notifications` CRUD API (list, unread_count, read, read_all, dismiss, clear), and a left-nav inbox module with a live unread badge polled via useLiveQuery. Known types render trilingual text from type+data (English stored text is the fallback); read rows are trimmed past a soft cap. Also adds the schema the maintenance job builds on: videos.list?part=status columns (embeddable/privacy_status/upload_status) and the validation lifecycle columns (last_checked_at, unavailable_since, unavailable_reason). Page-id validation is centralized in one PAGES source of truth (isPage) so the new page survives reload without a second allowlist to keep in sync.
This commit is contained in:
parent
74d46f61eb
commit
3ae42409b3
14 changed files with 649 additions and 22 deletions
43
backend/alembic/versions/0016_video_maintenance.py
Normal file
43
backend/alembic/versions/0016_video_maintenance.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
"""video maintenance / validation columns
|
||||
|
||||
Revision ID: 0016_video_maintenance
|
||||
Revises: 0015_scheduler_settings
|
||||
Create Date: 2026-06-18
|
||||
|
||||
Adds the columns the maintenance/validation job needs to detect and retire unplayable
|
||||
videos: videos.list?part=status fields (embeddable / privacy_status / upload_status) plus
|
||||
the validation lifecycle (last_checked_at for rolling re-validation; unavailable_since +
|
||||
unavailable_reason to flag a video as currently unplayable — hidden from the feed
|
||||
immediately, hard-deleted after a grace period). Purely additive; all columns nullable.
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision: str = "0016_video_maintenance"
|
||||
down_revision: Union[str, None] = "0015_scheduler_settings"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column("videos", sa.Column("embeddable", sa.Boolean(), nullable=True))
|
||||
op.add_column("videos", sa.Column("privacy_status", sa.String(length=16), nullable=True))
|
||||
op.add_column("videos", sa.Column("upload_status", sa.String(length=16), nullable=True))
|
||||
op.add_column("videos", sa.Column("last_checked_at", sa.DateTime(timezone=True), nullable=True))
|
||||
op.add_column("videos", sa.Column("unavailable_since", sa.DateTime(timezone=True), nullable=True))
|
||||
op.add_column("videos", sa.Column("unavailable_reason", sa.String(length=24), nullable=True))
|
||||
op.create_index("ix_videos_last_checked_at", "videos", ["last_checked_at"])
|
||||
op.create_index("ix_videos_unavailable_since", "videos", ["unavailable_since"])
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index("ix_videos_unavailable_since", table_name="videos")
|
||||
op.drop_index("ix_videos_last_checked_at", table_name="videos")
|
||||
op.drop_column("videos", "unavailable_reason")
|
||||
op.drop_column("videos", "unavailable_since")
|
||||
op.drop_column("videos", "last_checked_at")
|
||||
op.drop_column("videos", "upload_status")
|
||||
op.drop_column("videos", "privacy_status")
|
||||
op.drop_column("videos", "embeddable")
|
||||
Loading…
Add table
Add a link
Reference in a new issue