Files
youtube-app/backend/api/schemas.py
Marek Lenczewski ca988345e9 update
2026-04-07 17:55:30 +02:00

46 lines
972 B
Python

from pydantic import BaseModel, ConfigDict
class VideoCreate(BaseModel):
title: str
youtuber: str
thumbnailUrl: str
youtubeUrl: str
profileId: int | None = None
class VideoResponse(BaseModel):
id: int
title: str
youtuber: str
thumbnailUrl: str
youtubeUrl: str
isDownloaded: bool
profileIds: list[int]
model_config = ConfigDict(from_attributes=True)
@classmethod
def fromModel(cls, video):
return cls(
id=video.id,
title=video.title,
youtuber=video.youtuber,
thumbnailUrl=video.thumbnailUrl,
youtubeUrl=video.youtubeUrl,
isDownloaded=video.filePath is not None,
profileIds=[p.id for p in video.profiles],
)
class CleanupRequest(BaseModel):
profileId: int
excludeIds: list[int] = []
class ProfileResponse(BaseModel):
id: int
name: str
model_config = ConfigDict(from_attributes=True)