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,46 @@
|
||||
"""Reference data: languages, countries, certifications."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from sqlalchemy import ForeignKey, String, Text, UniqueConstraint
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.models.base import Base, TimestampMixin, UUIDPrimaryKeyMixin
|
||||
|
||||
|
||||
class Language(Base):
|
||||
"""ISO 639-1 language codes (e.g. 'en', 'ja')."""
|
||||
|
||||
__tablename__ = "languages"
|
||||
|
||||
code: Mapped[str] = mapped_column(String(10), primary_key=True)
|
||||
english_name: Mapped[str] = mapped_column(String(200), nullable=False)
|
||||
native_name: Mapped[str | None] = mapped_column(String(200), nullable=True)
|
||||
|
||||
|
||||
class Country(Base):
|
||||
"""ISO 3166-1 alpha-2 country codes (e.g. 'US', 'GB')."""
|
||||
|
||||
__tablename__ = "countries"
|
||||
|
||||
code: Mapped[str] = mapped_column(String(2), primary_key=True)
|
||||
name: Mapped[str] = mapped_column(String(200), nullable=False)
|
||||
|
||||
|
||||
class Certification(Base, UUIDPrimaryKeyMixin, TimestampMixin):
|
||||
"""Content rating within a country's rating system, e.g. US/MPA/PG-13."""
|
||||
|
||||
__tablename__ = "certifications"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("country_code", "system", "rating", name="uq_certification_scope"),
|
||||
)
|
||||
|
||||
country_code: Mapped[str] = mapped_column(ForeignKey("countries.code"), nullable=False)
|
||||
system: Mapped[str] = mapped_column(String(50), nullable=False) # e.g. "MPA", "BBFC"
|
||||
rating: Mapped[str] = mapped_column(String(20), nullable=False) # e.g. "PG-13"
|
||||
meaning: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
|
||||
country: Mapped[Country] = relationship()
|
||||
|
||||
|
||||
__all__ = ["Language", "Country", "Certification"]
|
||||
Reference in New Issue
Block a user