This commit is contained in:
Marek
2026-04-04 23:04:10 +02:00
parent 823adb707d
commit d789a31642
15 changed files with 232 additions and 0 deletions

35
backend/schemas.py Normal file
View File

@@ -0,0 +1,35 @@
from datetime import datetime
from pydantic import BaseModel
class VideoCreate(BaseModel):
title: str
youtuber: str
thumbnail_url: str
youtube_url: str
class VideoResponse(BaseModel):
id: int
title: str
youtuber: str
thumbnail_url: str
youtube_url: str
is_downloaded: bool
created_at: datetime
class Config:
from_attributes = True
@classmethod
def from_model(cls, video):
return cls(
id=video.id,
title=video.title,
youtuber=video.youtuber,
thumbnail_url=video.thumbnail_url,
youtube_url=video.youtube_url,
is_downloaded=video.file_path is not None,
created_at=video.created_at,
)