Initial Aurora Core 0.1 implementation
CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
Production-grade media metadata backend per docs/aurora-core-spec.md: Aurora-owned UUIDv7 identity system, normalized movie/TV/people/credits schema, provider abstraction with a TMDb adapter, an idempotent async ingestion pipeline (normalize -> match -> upsert -> provenance), a Postgres FTS/trigram search layer, a stateless FastAPI v1 API with Redis caching/rate-limiting, arq workers, dev/prod Docker Compose topologies, unit + integration + load tests, CI, and architecture/ database/API/ERD documentation. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
"""Videos/trailers as normalized entities (section 11).
|
||||
|
||||
Aurora never downloads copyrighted video media — only stores the
|
||||
provider's reference/URL and metadata about it.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import uuid
|
||||
from datetime import date
|
||||
|
||||
from sqlalchemy import Boolean, Date, ForeignKey, Index, String, UniqueConstraint
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.models.base import Base, TimestampMixin, UUIDPrimaryKeyMixin
|
||||
from app.models.enums import VideoType
|
||||
from app.models.provider import Provider
|
||||
|
||||
|
||||
class Video(Base, UUIDPrimaryKeyMixin, TimestampMixin):
|
||||
__tablename__ = "videos"
|
||||
__table_args__ = (
|
||||
Index("ix_videos_entity", "entity_type", "entity_id"),
|
||||
UniqueConstraint("provider_id", "provider_video_id", name="uq_video_provider_source"),
|
||||
)
|
||||
|
||||
# Polymorphic target: "movie", "series", "season", "episode".
|
||||
entity_type: Mapped[str] = mapped_column(String(30), nullable=False)
|
||||
entity_id: Mapped[uuid.UUID] = mapped_column(nullable=False)
|
||||
|
||||
video_type: Mapped[VideoType] = mapped_column(nullable=False)
|
||||
|
||||
provider_id: Mapped[uuid.UUID] = mapped_column(
|
||||
ForeignKey("providers.id", ondelete="CASCADE"), nullable=False
|
||||
)
|
||||
provider_video_id: Mapped[str] = mapped_column(String(200), nullable=False)
|
||||
site: Mapped[str | None] = mapped_column(String(100), nullable=True) # "YouTube", "Vimeo"
|
||||
url: Mapped[str] = mapped_column(String(1000), nullable=False)
|
||||
|
||||
language_code: Mapped[str | None] = mapped_column(
|
||||
ForeignKey("languages.code"), nullable=True
|
||||
)
|
||||
country_code: Mapped[str | None] = mapped_column(ForeignKey("countries.code"), nullable=True)
|
||||
is_official: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||||
published_at: Mapped[date | None] = mapped_column(Date, nullable=True)
|
||||
|
||||
provider: Mapped[Provider] = relationship()
|
||||
|
||||
|
||||
__all__ = ["Video"]
|
||||
Reference in New Issue
Block a user