🎉 Initial commit: AudiOhm - Alternative à Spotify avec streaming YouTube
Features: - Frontend Flutter avec thème néon cyberpunk - Backend FastAPI avec streaming YouTube - Base de données PostgreSQL + Redis - Authentification JWT complète - Recherche multi-source (DB + YouTube) - Playlists CRUD avec drag & drop - Queue management - Settings avec audio quality - Interface adaptative (Desktop + Mobile) Tech Stack: - Frontend: Flutter 3.2+, Riverpod - Backend: Python 3.11+, FastAPI - Database: PostgreSQL 15+ - Cache: Redis 7+ - Streaming: yt-dlp + FFmpeg 🚀 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
"""Playlist schemas."""
|
||||
from datetime import datetime
|
||||
from typing import Optional, List
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel, Field, ConfigDict
|
||||
|
||||
|
||||
class PlaylistBase(BaseModel):
|
||||
"""Base playlist schema."""
|
||||
|
||||
name: str = Field(..., min_length=1, max_length=255)
|
||||
description: Optional[str] = None
|
||||
image_url: Optional[str] = None
|
||||
is_public: bool = False
|
||||
is_collaborative: bool = False
|
||||
|
||||
|
||||
class PlaylistCreate(PlaylistBase):
|
||||
"""Schema for creating a playlist."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class PlaylistUpdate(BaseModel):
|
||||
"""Schema for updating a playlist."""
|
||||
|
||||
name: Optional[str] = Field(None, min_length=1, max_length=255)
|
||||
description: Optional[str] = None
|
||||
image_url: Optional[str] = None
|
||||
is_public: Optional[bool] = None
|
||||
is_collaborative: Optional[bool] = None
|
||||
|
||||
|
||||
class PlaylistResponse(PlaylistBase):
|
||||
"""Schema for playlist response."""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: UUID
|
||||
user_id: UUID
|
||||
track_count: int
|
||||
total_duration: int
|
||||
is_smart: bool
|
||||
smart_rules: dict
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
class PlaylistWithTracks(PlaylistResponse):
|
||||
"""Schema for playlist with tracks."""
|
||||
|
||||
tracks: List[dict] = Field(default_factory=list)
|
||||
|
||||
|
||||
class AddTrackRequest(BaseModel):
|
||||
"""Schema for adding tracks to playlist."""
|
||||
|
||||
track_ids: List[UUID] = Field(..., min_length=1, max_length=100)
|
||||
position: Optional[int] = None
|
||||
|
||||
|
||||
class ReorderTracksRequest(BaseModel):
|
||||
"""Schema for reordering tracks in playlist."""
|
||||
|
||||
track_id: UUID
|
||||
new_position: int = Field(..., ge=0)
|
||||
|
||||
|
||||
class PlaylistTrackResponse(BaseModel):
|
||||
"""Schema for playlist track response."""
|
||||
|
||||
id: UUID
|
||||
playlist_id: UUID
|
||||
track_id: UUID
|
||||
position: int
|
||||
added_at: datetime
|
||||
added_by: Optional[UUID] = None
|
||||
track: Optional[dict] = None
|
||||
Reference in New Issue
Block a user