Builds on the accounts foundation: PUT/DELETE a rating (0.5-10.0) or a
watchlist entry on any movie or series, all scoped to the bearer token's
own user, plus GET /account/ratings|watchlist/{movies,series} to list
them back. Both are polymorphic entity_type/entity_id tables, same shape
as watch_provider_offerings and trending_entries, so movie and series
share one repository/router each rather than duplicating per type.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
121 lines
2.9 KiB
Python
121 lines
2.9 KiB
Python
"""Movie response schemas."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import date, datetime
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from app.schemas.common import (
|
|
AlternateTitleOut,
|
|
CastCreditOut,
|
|
CollectionBriefOut,
|
|
CompanyBriefOut,
|
|
CrewCreditOut,
|
|
GenreOut,
|
|
ImagesOut,
|
|
KeywordOut,
|
|
ReleaseDateOut,
|
|
VideoOut,
|
|
WatchProviderRegionOut,
|
|
)
|
|
|
|
|
|
class MovieSummaryOut(BaseModel):
|
|
"""Compact movie representation used in lists and search results."""
|
|
|
|
id: str
|
|
type: str = "movie"
|
|
title: str
|
|
original_title: str | None = None
|
|
overview: str | None = None
|
|
release_date: date | None = None
|
|
poster_path: str | None = None
|
|
popularity: float | None = None
|
|
vote_average: float | None = None
|
|
|
|
|
|
class MovieDetailOut(BaseModel):
|
|
id: str
|
|
type: str = "movie"
|
|
title: str
|
|
original_title: str | None = None
|
|
overview: str | None = None
|
|
tagline: str | None = None
|
|
status: str
|
|
original_language: str | None = None
|
|
release_date: date | None = None
|
|
runtime: int | None = None
|
|
budget: int | None = None
|
|
revenue: int | None = None
|
|
popularity: float | None = None
|
|
vote_average: float | None = None
|
|
vote_count: int | None = None
|
|
adult: bool = False
|
|
# The US MPA rating (e.g. "PG-13"), the badge TMDb shows next to a
|
|
# title by default -- convenience pick out of `release_dates` below for
|
|
# a client that just wants a single rating without picking a country.
|
|
certification: str | None = None
|
|
|
|
genres: list[GenreOut] = []
|
|
keywords: list[KeywordOut] = []
|
|
alternate_titles: list[AlternateTitleOut] = []
|
|
cast: list[CastCreditOut] = []
|
|
crew: list[CrewCreditOut] = []
|
|
companies: list[CompanyBriefOut] = []
|
|
collection: CollectionBriefOut | None = None
|
|
images: ImagesOut = ImagesOut()
|
|
videos: list[VideoOut] = []
|
|
release_dates: list[ReleaseDateOut] = []
|
|
watch_providers: dict[str, WatchProviderRegionOut] = {}
|
|
external_ids: dict[str, str] = {}
|
|
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class MovieWatchProvidersOut(BaseModel):
|
|
id: str
|
|
results: dict[str, WatchProviderRegionOut] = {}
|
|
|
|
|
|
class MovieCreditsOut(BaseModel):
|
|
id: str
|
|
cast: list[CastCreditOut] = []
|
|
crew: list[CrewCreditOut] = []
|
|
|
|
|
|
class MovieImagesOut(BaseModel):
|
|
id: str
|
|
images: ImagesOut = ImagesOut()
|
|
|
|
|
|
class MovieVideosOut(BaseModel):
|
|
id: str
|
|
videos: list[VideoOut] = []
|
|
|
|
|
|
class MovieRecommendationsOut(BaseModel):
|
|
id: str
|
|
recommendations: list[MovieSummaryOut] = []
|
|
|
|
|
|
class MovieListOut(BaseModel):
|
|
page: int
|
|
page_size: int
|
|
total_results: int
|
|
total_pages: int
|
|
results: list[MovieSummaryOut] = []
|
|
|
|
|
|
class RatedMovieOut(MovieSummaryOut):
|
|
rating: float
|
|
|
|
|
|
class RatedMovieListOut(BaseModel):
|
|
page: int
|
|
page_size: int
|
|
total_results: int
|
|
total_pages: int
|
|
results: list[RatedMovieOut] = []
|