Add Movie endpoint

This commit is contained in:
Esa Kataja
2024-11-09 18:32:28 +02:00
parent 88e1d1c54b
commit 60ff8a296d
3 changed files with 108 additions and 13 deletions
+35 -10
View File
@@ -4,13 +4,38 @@ from typing import Optional
class Movie(BaseModel):
id: Optional[str]
name: str
imdb_id: str
actors: list[str]
plot: str
release_date: datetime
showtime: datetime
is_watched: bool = Field(default=False)
created_at: datetime = Field(default_factory=datetime.utcnow)
updated_at: datetime = Field(default_factory=datetime.utcnow)
id: Optional[str] = Field(
default=None, examples=["123e4567-e89b-12d3-a456-426655440000"]
)
name: str = Field(
description="Name of the movie", examples=["A Maple Valley Christmas"]
)
imdb_id: str = Field(description="IMDB ID of the movie", examples=["tt1234567"])
actors: list[str] = Field(
description="Actors of the movie",
examples=[["Peyton List", "Andrew W. Walker"]],
)
plot: str = Field(
description="Plot of the movie", examples=["Erica is a rancher..."]
)
release_date: datetime = Field(
description="Release date of the movie", examples=["2022-11-05"]
)
showtime: datetime = Field(
description="Showtime of the movie", examples=["2024-12-01"]
)
is_watched: bool = Field(
default=False,
description="Whether the movie is watched or not",
examples=[True],
)
created_at: datetime = Field(
default_factory=datetime.utcnow,
description="Creation date of the movie",
examples=[datetime.utcnow()],
)
updated_at: datetime = Field(
default_factory=datetime.utcnow,
description="Modification date of the movie",
examples=[datetime.utcnow()],
)