mirror of
https://github.com/StepanovPlaton/torrent_backend.git
synced 2026-04-03 20:30:38 +04:00
Add audiobooks
This commit is contained in:
@@ -1,2 +1,4 @@
|
||||
from .games import *
|
||||
from .movies import *
|
||||
from .audiobooks import *
|
||||
from .users import *
|
||||
|
||||
51
database/schemas/audiobooks.py
Normal file
51
database/schemas/audiobooks.py
Normal file
@@ -0,0 +1,51 @@
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class AudiobookCardBase(BaseModel):
|
||||
title: str = Field(examples=["Марсианин"])
|
||||
cover: Optional[str] = \
|
||||
Field(default=None, examples=["cover_filename.jpg"])
|
||||
description: Optional[str] = \
|
||||
Field(default=None,
|
||||
examples=["Главный герой оказался в сложнейшей ситуации."
|
||||
" Его жизнь висела на волоске и зависела от"
|
||||
" нескольких совершенно нелогичных факторов."
|
||||
" Дело в том, что его бросили на Марсе в крайне"
|
||||
" затруднительном для дальнейшей жизни положении."
|
||||
" Рассчитывать стоит лишь на себя и на чудо,"
|
||||
" ведь ультрасовременный скафандр оказался прошит"
|
||||
" антенной, а до прибытия следующей экспедиции"
|
||||
" остается целая вечность."])
|
||||
author: Optional[str] = \
|
||||
Field(default=None, examples=["Вейр Энди"])
|
||||
|
||||
|
||||
class AudiobookCard(AudiobookCardBase):
|
||||
id: int = Field(examples=[1])
|
||||
|
||||
|
||||
class AudiobookBase(AudiobookCardBase):
|
||||
torrent_file: str = Field(examples=["torrent_filename.torrent"])
|
||||
fragment: Optional[str] = \
|
||||
Field(default=None, examples=[
|
||||
"fragment.mp3"])
|
||||
|
||||
language: Optional[str] = Field(default=None, examples=["рус"])
|
||||
release_date: Optional[str] = Field(default=None, examples=["2015"])
|
||||
download_size: Optional[str] = Field(default=None, examples=["300Mb"])
|
||||
duration: Optional[str] = Field(default=None, examples=["12:38"])
|
||||
reader: Optional[str] = Field(default=None, examples=["Дмитрий Хазанович"])
|
||||
|
||||
|
||||
class AudiobookCreate(AudiobookBase):
|
||||
pass
|
||||
|
||||
|
||||
class Audiobook(AudiobookBase):
|
||||
id: int = Field(examples=[1])
|
||||
update_date: str = Field(examples=["2024-06-14 12:00:00"])
|
||||
upload_date: str = Field(examples=["2024-06-14 12:00:00"])
|
||||
owner_id: int = Field(examples=[1])
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
@@ -1,10 +1,9 @@
|
||||
from typing import Optional
|
||||
from fastapi import Body
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class GameCardBase(BaseModel):
|
||||
title: str = Field(examples=["DwarfFortress", "RimWorld"])
|
||||
title: str = Field(examples=["DwarfFortress"])
|
||||
cover: Optional[str] = \
|
||||
Field(default=None, examples=["cover_filename.jpg"])
|
||||
description: Optional[str] = \
|
||||
|
||||
55
database/schemas/movies.py
Normal file
55
database/schemas/movies.py
Normal file
@@ -0,0 +1,55 @@
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class MovieCardBase(BaseModel):
|
||||
title: str = Field(examples=["Интерстеллар"])
|
||||
cover: Optional[str] = \
|
||||
Field(default=None, examples=["cover_filename.jpg"])
|
||||
description: Optional[str] = \
|
||||
Field(default=None,
|
||||
examples=["Когда засуха, пыльные бури и вымирание"
|
||||
" растений приводят человечество к"
|
||||
" продовольственному кризису, коллектив"
|
||||
" исследователей и учёных отправляется"
|
||||
" сквозь червоточину (которая предположительно"
|
||||
" соединяет области пространства-времени"
|
||||
" через большое расстояние) в путешествие,"
|
||||
" чтобы превзойти прежние ограничения для"
|
||||
" космических путешествий человека и найти"
|
||||
" планету с подходящими для человечества условиями."])
|
||||
age: Optional[str] = \
|
||||
Field(default=None, examples=["18+"])
|
||||
|
||||
|
||||
class MovieCard(MovieCardBase):
|
||||
id: int = Field(examples=[1])
|
||||
|
||||
|
||||
class MovieBase(MovieCardBase):
|
||||
torrent_file: str = Field(examples=["torrent_filename.torrent"])
|
||||
trailer: Optional[str] = \
|
||||
Field(default=None, examples=[
|
||||
"https://www.youtube.com/watch?v=6ybBuTETr3U"])
|
||||
|
||||
language: Optional[str] = Field(default=None, examples=["рус"])
|
||||
subtitles: Optional[str] = Field(default=None, examples=["Отсутствуют"])
|
||||
release_date: Optional[str] = Field(default=None, examples=["2014"])
|
||||
download_size: Optional[str] = Field(default=None, examples=["32Gb"])
|
||||
director: Optional[str] = Field(default=None, examples=["Кристофер Нолан"])
|
||||
duration: Optional[str] = Field(default=None, examples=["02:37:58"])
|
||||
country: Optional[str] = \
|
||||
Field(default=None, examples=["США, Великобритания, Канада"])
|
||||
|
||||
|
||||
class MovieCreate(MovieBase):
|
||||
pass
|
||||
|
||||
|
||||
class Movie(MovieBase):
|
||||
id: int = Field(examples=[1])
|
||||
update_date: str = Field(examples=["2024-06-11 12:00:00"])
|
||||
upload_date: str = Field(examples=["2024-06-11 12:00:00"])
|
||||
owner_id: int = Field(examples=[1])
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
Reference in New Issue
Block a user