This commit is contained in:
Marek Lenczewski
2026-04-07 17:55:30 +02:00
parent 8f15f51bce
commit ca988345e9
19 changed files with 201 additions and 203 deletions

View File

@@ -1,47 +1,45 @@
from pydantic import BaseModel
from pydantic import BaseModel, ConfigDict
class VideoCreate(BaseModel):
title: str
youtuber: str
thumbnail_url: str
youtube_url: str
profile_id: int | None = None
thumbnailUrl: str
youtubeUrl: str
profileId: int | None = None
class VideoResponse(BaseModel):
id: int
title: str
youtuber: str
thumbnail_url: str
youtube_url: str
is_downloaded: bool
profile_ids: list[int]
thumbnailUrl: str
youtubeUrl: str
isDownloaded: bool
profileIds: list[int]
class Config:
from_attributes = True
model_config = ConfigDict(from_attributes=True)
@classmethod
def from_model(cls, video):
def fromModel(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,
profile_ids=[p.id for p in video.profiles],
thumbnailUrl=video.thumbnailUrl,
youtubeUrl=video.youtubeUrl,
isDownloaded=video.filePath is not None,
profileIds=[p.id for p in video.profiles],
)
class CleanupRequest(BaseModel):
profile_id: int
exclude_ids: list[int] = []
profileId: int
excludeIds: list[int] = []
class ProfileResponse(BaseModel):
id: int
name: str
class Config:
from_attributes = True
model_config = ConfigDict(from_attributes=True)