-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
89 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from pydantic import BaseModel | ||
|
||
|
||
class UUIDBase(BaseModel): | ||
"""Модель для базового класса.""" | ||
|
||
id: str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,41 @@ | ||
from pydantic import BaseModel | ||
from dataclasses import dataclass | ||
|
||
from models.base import UUIDBase | ||
from models.genre import Genre | ||
from models.person import Person | ||
|
||
|
||
@dataclass | ||
class FilmWork(UUIDBase): | ||
"""Модель для хранения информации о фильме.""" | ||
|
||
title: str | ||
imdb_rating: float | ||
description: str | ||
genre: list[Genre] | ||
actors: list[Person] | ||
writers: list[Person] | ||
directors: list[Person] | ||
|
||
|
||
class FilmMinimal(UUIDBase): | ||
"""Модель для хранения краткой информации о фильме.""" | ||
|
||
class Film(BaseModel): | ||
id: str | ||
title: str | ||
imdb_rating: float | ||
description: str | ||
writers: list[Person] | ||
directors: list[Person] | ||
|
||
|
||
class FilmShort(UUIDBase): | ||
"""Модель для хранения краткой информации о фильме на главной странице.""" | ||
|
||
title: str | ||
imdb_rating: float | ||
|
||
|
||
class FilmWorkMinimal(UUIDBase): | ||
"""Модель для хранения краткой информации о кинопроизведении.""" | ||
|
||
class Config: | ||
pass | ||
roles: list[str] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from models.base import UUIDBase | ||
|
||
|
||
class Genre(UUIDBase): | ||
"""Модель для хранения информации жанре в кинопроизведении.""" | ||
|
||
name: str | ||
description: str | ||
|
||
|
||
class GenreMinimal(UUIDBase): | ||
"""Модель для хранения краткой информации о жанре.""" | ||
|
||
name: str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from models.base import UUIDBase | ||
from models.film import FilmWorkMinimal | ||
from pydantic import Field | ||
|
||
|
||
class Person(UUIDBase): | ||
"""Модель для хранения актёра.""" | ||
|
||
full_name: str = Field(alias="name") | ||
films: list[FilmWorkMinimal] |